diff options
| author | Tradam <[email protected]> | 2024-05-16 15:22:12 -0400 |
|---|---|---|
| committer | Tradam <[email protected]> | 2024-05-16 15:22:12 -0400 |
| commit | 6ae14ae3a10d79e5f0b70b1b1af74e8a3507bb83 (patch) | |
| tree | ef5ed5e9277dc3c69cc938634ac1351920b91ad8 /app/javascript/components/Layout.jsx | |
| parent | 519568969b9ff3a47e595073a40fef099586e3c9 (diff) | |
| download | gameHolster-6ae14ae3a10d79e5f0b70b1b1af74e8a3507bb83.tar.gz gameHolster-6ae14ae3a10d79e5f0b70b1b1af74e8a3507bb83.zip | |
isolate serving of user HTML files to a seperate domain
Diffstat (limited to 'app/javascript/components/Layout.jsx')
| -rw-r--r-- | app/javascript/components/Layout.jsx | 12 |
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]"> |
