Skip to content

Commit

Permalink
Try fix Content-Security-Policy
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminaaron committed Oct 28, 2024
1 parent 615a7c5 commit ce5d122
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
19 changes: 8 additions & 11 deletions public/404.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script type="text/javascript">
let pathname = encodeURIComponent(window.location.pathname);
let hash = encodeURIComponent(window.location.hash);
window.location.replace('/index.html?pathname=' + pathname + '&hash=' + hash);
</script>
</head>
<body>
404, redirecting to index.html ...
</body>
<head>
<meta charset="UTF-8">
<meta http-equiv="Content-Security-Policy" content="script-src 'self'; img-src 'self' data:">
<script src="/redirect.js"></script>
</head>
<body>
404, redirecting to index.html ...
</body>
</html>
4 changes: 4 additions & 0 deletions public/redirect.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
let pathname = encodeURIComponent(window.location.pathname);
let hash = encodeURIComponent(window.location.hash);

window.location.replace('/index.html?pathname=' + pathname + '&hash=' + hash);

0 comments on commit ce5d122

Please sign in to comment.