httphttpssafarihsts

Safari keeps forcing HTTPS on localhost


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?


Solution

  • 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.