Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

My specific installation of Safari refuses to open my website

My copy of Safari refuses to open my website, example.com.

Every time I try and visit http://example.com Safari (not the server!) redirects me to https://example.com, and immediately tells me:

"Safari can't open the page "https://example.com" because Safari can't connect to the server "example.com".

  • The site does not have HTTPS enabled or a certificate installed (though it once did)
  • The site works perfectly in Chrome
  • The site works perfectly in iOS Safari
  • The site works perfectly in Safari on a different computer

It seems like my copy of Safari has 'cached' the HTTPS redirect or something.

Here is what I have tried:

  • Clearing the Safari cache
  • Disabling the Safari cache
  • Clearing the OS X DNS cache
  • System reboots
  • Intentionally accessing the HTTPS version
  • Intentionally accessing the HTTP version
  • Appending random query strings

But still every time I instantly get the message. It appears in a matter of milliseconds making me assume it's cached somewhere.

When trying on a Guest account, the problem goes away. However, both my Mac at home and at work are affected, presumably because iCloud is syncing some kind of Safari cache file.

This thread here seems to hint it is to do with HSTS (as @rluta has thought), or alternatively to do with Strict-Transport-Security headers being set. I have confirmed and no Strict-Transport-Security headers are being set when the webpage is accessed.

If at all possible I really don't want to have to "reset" my copy of Safari as I use it for everything day to day. Any ideas?

like image 666
Jack Avatar asked Jul 08 '15 08:07

Jack


3 Answers

Over at the Apple Support Forum, the following was reported to resolve the issue:

  1. Clear the cache
  2. Delete all entries for the domain from the history
  3. Delete HTST.plist
  4. Reboot the system

Hope that helps.

like image 152
agoeb Avatar answered Nov 02 '22 06:11

agoeb


Since your site used to support HTTPS, you probably have a cached HSTS entry that directs Safari to always use HTTPS to connect to your site.

You can purge your HSTS settings in Safari like this:

  • close Safari
  • delete the ~/Library/Cookies/HSTS.plist file on your disk (or edit the file and remove just your site entry if you want to preserve other entries)
  • reopen Safari
like image 3
rluta Avatar answered Nov 02 '22 04:11

rluta


Have you tried to clear the history in Safari?

like image 1
Buyuk Avatar answered Nov 02 '22 04:11

Buyuk