Skip to content

Commit

Permalink
Don't default https://localhost.psim.us to HTTPS
Browse files Browse the repository at this point in the history
Anyone who wants to test on HTTPS can use localhost-443.psim.us.

This can help with the issue where browsers prefer HTTPS over HTTP.
There was an actual Cloudflare issue that made HTTP straight-up
stop working for a while, but that one appears to be fixed now.
  • Loading branch information
Zarel committed Nov 16, 2023
1 parent 9d8655c commit 426656e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion js/clean-cookies.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
}

if ($cleaned) {
echo 'alert("You had a cookie which was too big to handle and had to be deleted. If you had cookie settings, they may not be right.")';
echo 'alert("You had a cookie which was too big to handle and had to be deleted. If you had cookie settings, they may have been deleted.")';
}
6 changes: 6 additions & 0 deletions js/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,12 @@ function toId() {

var self = this;
var constructSocket = function () {
if (location.host === 'localhost.psim.us' || /[0-9]+.[0-9]+.[0-9]+.[0-9]+\.psim\.us/.test(location.host)) {
// normally we assume HTTPS means HTTPS, but make an exception for
// localhost and IPs which generally can't have a signed cert anyway.
Config.server.port = 8000;
Config.server.https = false;
}
var protocol = (Config.server.port === 443 || Config.server.https) ? 'https' : 'http';
Config.server.host = $.trim(Config.server.host);
try {
Expand Down

0 comments on commit 426656e

Please sign in to comment.