Merge pull request #8 from JayWll/glitch

Updating redirect code to allow embedding on the glitch project page
This commit is contained in:
JayWll 2020-05-10 14:15:31 -06:00 committed by GitHub
commit fcdf59da22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,10 +7,10 @@ const app = express();
// Handle requests for the root page by serving the static index.html from the views folder
app.get("/", function(req, res) {
if (req.headers.host.includes('glitch.me')) {
if (!(req.headers['referer'] == 'https://glitch.com/embed/' && req.headers['sec-fetch-dest'] == 'iframe') && !req.headers['x-real-host'] && req.headers.host.includes('glitch.me')) {
return res.redirect('https://www.jasonsplant.ml' + req.url);
}
res.sendFile(__dirname + "/views/index.html");
});