Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ nav_order: 1
---

<!-- Auto redirect to the entry point of the mainsite -->
<meta http-equiv="refresh" content="0; url=https://owasp.github.io/secure-headers-project/index/" />
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">
<p>If you are not redirected automatically, <a href="https://owasp.github.io/secure-headers-project/index/">click here</a>.</p>
<script> window.location.href = "https://owasp.github.io/secure-headers-project/index/"; </script>
<script src="mainsite/assets/js/root-path-redirection-handler.js"></script>
51 changes: 0 additions & 51 deletions mainsite/assets/js/direct-link-handler.js

This file was deleted.

20 changes: 20 additions & 0 deletions mainsite/assets/js/root-path-redirection-handler.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
Script to dynamically handle the redirection to the "/index" path depending on the initial domain requested:
- The GitHub page
- The custom sub domain
*/
const owaspSubDomain = "secure-headers-project.owasp.org";
const githubPageSubDomain = "owasp.github.io";
const sourceDomain = window.location.hostname;

if (sourceDomain === owaspSubDomain) {
const targetLocation = `https://${owaspSubDomain}/index/`;
console.info(`Visitor come from the custom sub domain so redirect it to '${targetLocation}'...`);
window.location.replace(targetLocation);
} else if (sourceDomain === githubPageSubDomain) {
const targetLocation = `https://${githubPageSubDomain}/secure-headers-project/index/`;
console.info(`Visitor come from the GH page domain so redirect it to '${targetLocation}'...`);
window.location.replace(targetLocation);
} else {
console.error("The source domain is not an expected one so do nothing !");
}
Loading