When I load http://localhost:3000
in Safari, Safari automatically redirects to https://localhost:3000
. How can I disable this functionality?
I went into ~/Library/Cookies/HSTS.plist
and removed the localhost
entry, then restarted Safari but it just re-added it to that plist file and redirected to https.
Any ideas how to fix this so that on localhost
I have to explicitly say http or https?
To the right of your domain, click the Settings button. In the AUTOMATIC HTTPS IS ENABLED FOR THIS SITE section you will see a green lock icon. Click Change Automatic HTTPS Setting. Then click the Disable Automatic HTTPS button.
Unlike Chrome, Edge, and Firefox, Safari doesn't have an HTTPS-only mode. However, what it does have is the ability to automatically switch sites from HTTP to HTTPS if available. The feature is enabled by default with Safari 15 on macOS Monterey, macOS Big Sur, and macOS Catalina.
Issues Connecting to Localhost with Safari Follow When asked to make some types of connection to localhost or 127.0. 0.1, Safari may ignore any configured proxy. This may cause Safari to not fetch traffic via Sauce Connect, causing tests to fail. To prevent this, use a different hostname for the system under test.
I was able to solve this based on an answer from Ask Different.
In short, closing Safari, then running the commands below, worked.
sudo killall nsurlstoraged rm -f ~/Library/Cookies/HSTS.plist launchctl start /System/Library/LaunchAgents/com.apple.nsurlstoraged.plist
Restarting Safari after running that and trying to go to http://localhost:3000
solved the problem and did not redirect to to https
.
Hopefully this helps someone fix this problem.
In Safari 13.0.5, deleting website data for localhost
(Safari > Preferences > Privacy > Manage Website Data...) solves the problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With