summaryrefslogtreecommitdiffhomepage
path: root/app/javascript
diff options
context:
space:
mode:
authorTradam <[email protected]>2024-05-16 15:22:12 -0400
committerTradam <[email protected]>2024-05-16 15:22:12 -0400
commit6ae14ae3a10d79e5f0b70b1b1af74e8a3507bb83 (patch)
treeef5ed5e9277dc3c69cc938634ac1351920b91ad8 /app/javascript
parent519568969b9ff3a47e595073a40fef099586e3c9 (diff)
downloadgameHolster-6ae14ae3a10d79e5f0b70b1b1af74e8a3507bb83.tar.gz
gameHolster-6ae14ae3a10d79e5f0b70b1b1af74e8a3507bb83.zip
isolate serving of user HTML files to a seperate domain
Diffstat (limited to 'app/javascript')
-rw-r--r--app/javascript/components/Layout.jsx12
1 files changed, 12 insertions, 0 deletions
diff --git a/app/javascript/components/Layout.jsx b/app/javascript/components/Layout.jsx
index 30d1086..79e7813 100644
--- a/app/javascript/components/Layout.jsx
+++ b/app/javascript/components/Layout.jsx
@@ -5,6 +5,18 @@ export default function Layout ({userData})
{
console.log(userData);
//const [userData, setUserData] = useState({ name: "" });
+
+ // if the user tries to access the isolated domain then we redirect them
+ // this is NOT done for security, only for good UX
+ // rails serves the react app no matter what
+ // so the app would be broken when served on the isolated domain
+ const domain = window.location.host;
+ console.log(domain);
+ if(domain === "localhost:3000")
+ {
+ window.location.replace("http://127.0.0.1:3000");
+ }
+
return (
<>
<div id="page" className="star flex flex-row min-h-screen max-h-screen bg-amber-400 text-stone-950 text-xl bg-star bg-repeat bg-[length:170px_170px]">