Skip to content

Commit 5daeec6

Browse files
authored
Redirect http traffic to https (#1640)
1 parent 0317463 commit 5daeec6

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

js/index.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,3 +151,13 @@ $(document).ready(function() {
151151

152152
$("#shuffled-cases").children().shuffle()
153153
});
154+
155+
// Automatically redirect to https
156+
(function (){
157+
const location = window.location.href;
158+
const localhost = /:\/\/(?:localhost|127.0.0.1|::1)/
159+
160+
if (location.startsWith("http://") && !localhost.test(location)) {
161+
window.location.href = location.replace("http://", "https://");
162+
}
163+
})();

0 commit comments

Comments
 (0)