You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Safari forcing HTTPS for some HTTP only sites

I have a strange issue with Safari (7.0.1 on Mavericks 10.9.1). It is similar to a few other issues that folk have posted about here but I am opening a separate post because some of the details are different. Please read to the end before suggesting I try disabling extensions, clear cache etc.


This issue is affecting only one user on one Mac (we have several users and several Macs).


We host our own web-site using OS X Server (Mavericks / Server 3.0). Soem areas of the site support both HTTP and HTTPS access. For example:


Live (public) site


http://www.ourdomain.com (on port 80)

https://www.ourdomain.com (on port 443)


and


Test (internal) site

http://www.ourdomain.com:81

https://www.ourdomain.com:444


and


Intranet (internal)


http://www.ourdomain.com:8080


Most areas of the site do not require HTTPS protection and in particular for the Test site both the htp and the https versions have explicit ports. For the Intranet site there is no HTTPS version. For the live and test sites, a certain sub-set of the site requires user authentication and I have redirects setup to redirect access to just those areas via the HTTPS URL which also enforces user authentication.


This setup all works fine, except for this one user on this one machine and only when they use Safari (Chrome and FireFox are fine)...


They have Safari bookmarks saved for the HTTP URLs and after a while:


1. These bookmarks start referring to tthe HTTPS URLs. The actual bookmarks get changed and the http gets changed to https! In the case of the Test and Intranet sites these URLs are not even valid. So, the bookmarks no longer work. If we edit the bookmarks and change them back to http they immediately revert back to https!


2. If one types the HTTP URL directly into the address bar then Safari ignores the HTTP and instead tries to go to the HTTPS version of the URL.


Basically, there is no way to get Safari to access the HTTP versions of any of these URLs with the resuklt that the Test and Intranet sites are unusable.


This user only has the same extensions as other users have and they all work okay. We have tried disabling extensions but it does not resolve the issue. Doing a full reset of Safari will resolve the issue temporarily but this deletes a lot of stuff, such as History, that the user does not want deleted. And the issue always recurs after a while anyway.


Does anyone have any idea what is causing this behaviour and how to prevent it? It is driving me and the affected user mad!

iMac, OS X Mavericks (10.9)

Posted on Feb 9, 2014 6:09 AM

Reply
Question marked as Top-ranking reply

Posted on Mar 1, 2014 10:47 PM

I thought I was going mad, but apparently I'm not alone! I have the same exact issue as you. The links will automatically change back to HTTPS. If I change the URL manually to be HTTP it still attempts to redirect to an HTTPS URL. If I enter the same URL in another browser it works just fine.


Anyone else encounter this or have any other tips to offer besides resetting the Safari?

32 replies

Oct 15, 2014 5:47 AM in response to Streeme

Streeme, did you manage to reset the history in Safari? Since the HSTS.plist is recreated after deleting it Safari has to save those entries somewhere else., otherwise the file would be empty after recreating it. If the current Safari has some issues with following the instructions for Strict Transport Security and a future version, e.g. in Yosemite, fixes those then you should be able to access the site without being redirected. I can't tell whether Safari is faulty and it's weird that other browsers work fine. Is the web server for your site sending an HSTS header? See the instructions I posted above to check.

Nov 29, 2014 6:23 AM in response to lenn4rd

Well, I have the same problem, and it drives me nuts!


I have a debian server running an apache 2 web server, hosting toto.mydomain.com, with http and https connections. Depending on the http or https address, 2 web sites are then displayed. BUT, safari still automatically redirects me to the https address. I have tested everything mentioned above, nothing works. I have even modified the web server response to set HSTS response to 0:


> curl -I https://toto.maydomain.com

HTTP/1.1 200 OK

Date: Sat, 29 Nov 2014 13:53:48 GMT

Server: Apache/2.2.22 (Debian)

X-Powered-By: PHP/5.4.35-0+deb7u2

Set-Cookie: 52152665cd64c=s5kjtuc3muhphhu5q8lq8ovvp4; path=/; HttpOnly

Expires: Thu, 19 Nov 1981 08:52:00 GMT

Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0

Pragma: no-cache

Strict-Transport-Security: max-age=0

X-XSS-Protection: 1; mode=block

X-Content-Type-Options: nosniff

X-Frame-Options: Sameorigin

Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; frame-src *; img-src *; font-src 'self' data:; media-src *

X-Robots-Tag: none

Vary: Accept-Encoding

Content-Type: text/html; charset=utf-8


But safari keeps redirecting me to the https version of the website.


I really don't understand what is happening.


But if I use a fresh new account on the system, this redirection does not occur any more, even if I visit the https version of the website.

So a cache, somewhere in the system, must be cleared. But which one? HSTS.plist removal has no effect here.


EDIT : the only solution I had not tried was to reboot the system after 1/ clearing the cache, 2/ deleting every entries for toto.mydomain.com from the history, and 3/ deleting HTST.plist. And ... it works now!

Jun 9, 2015 3:07 PM in response to Sylar12

Doesn't that clear all your logins and stuff from every other site you have?


Apple come on!


Look here, I have changed it: https://www.dropbox.com/s/ny2vfqat6mtrnyz/Sk%C3%A4rmklipp%202015-06-10%2000.01.3 6.png?dl=0

And then right after it changes back: https://www.dropbox.com/s/akp8zphv2dykzjs/Sk%C3%A4rmklipp%202015-06-10%2000.02.4 7.png?dl=0


I can't force Safari to visit the http version by typing it in either....


EDIT: If I use the IP however, I can choose manually, and change the bookmark... very strange...

Dec 14, 2015 6:56 AM in response to Sylar12

So I have to say that I have had no luck when it comes to resetting Safari. I actually created a brand new local user account and tried it there, but it still switches to https. I figured that I have my server configured wrong using Strict Transport Security, however that is not the case. I did, but I removed the line in the nginx config file. when I do the curl -I thingy I get this:


mbp:~ user$ curl -I http://www.domain.com

HTTP/1.1 200 OK

Server: nginx

Date: Mon, 14 Dec 2015 14:40:40 GMT

Content-Type: text/html; charset=UTF-8

Connection: keep-alive

Vary: Accept-Encoding

Set-Cookie: frontend=j0il7j0lr16fb2inuj2hsf1i66; expires=Wed, 13-Jan-2016 14:40:39 GMT; Max-Age=2592000; path=/

Expires: Thu, 19 Nov 1981 08:52:00 GMT

Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0

Pragma: no-cache

X-Frame-Options: SAMEORIGIN

X-Config-By: LD

X-Frame-Options: SAMEORIGIN

X-Content-Type-Options: nosniff

X-XSS-Protection: 1; mode=block

X-UA-Compatible: IE=Edge,chrome=1

X-Processing-Time: 0.580



mbp:~ user$ curl -I https://www.domain.com

HTTP/1.1 200 OK

Server: nginx

Date: Mon, 14 Dec 2015 14:41:31 GMT

Content-Type: text/html; charset=UTF-8

Connection: keep-alive

Vary: Accept-Encoding

Set-Cookie: frontend=tnghb13jdn3klhffebpnvmruo1; expires=Wed, 13-Jan-2016 14:41:31 GMT; Max-Age=2592000; path=/

Expires: Thu, 19 Nov 1981 08:52:00 GMT

Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0

Pragma: no-cache

Set-Cookie: frontend_cid=ld6irzeXL135A8Ml; expires=Wed, 13-Jan-2016 14:41:31 GMT; Max-Age=2592000; path=/; domain=www.domain.com; secure

X-Frame-Options: SAMEORIGIN

X-Config-By: LD

X-Frame-Options: SAMEORIGIN

X-Content-Type-Options: nosniff

X-XSS-Protection: 1; mode=block

X-UA-Compatible: IE=Edge,chrome=1

X-Processing-Time: 0.566



My iPhone Safari even is showing it in http://, no problem there. Chrome, Firefox... no problem, IE on Windows 10, no problem, Safari on Windows - no problem!!!!! What is going on here?

Jan 18, 2016 1:26 PM in response to ChrisJenkins

Well, we're coming up on almost two years since you first noticed this, and Apple is no closer to giving a flip about fixing it than they were back then, apparently 😠


I'm having the same problem with Safari utterly disregarding my bookmarks as entered, as well as direct entry of the URL. It seems once I visit any HTTPS page on my domain, Safari sees fit to ignore everything unsecured on that domain from that point forward.


I SHOULD NOT HAVE TO RESET MY BROWSER TO MAKE IT RESPECT MY BOOKMARKS AS ENTERED, APPLE!!! Stop trying to think FOR me and fix your broken software!

Jul 9, 2016 9:25 AM in response to ChrisJenkins

This fixes it in the latest safari (July 2016):


- Quit safari

- Edit this file : ~/Library/Cookies/HSTS.plist and remove the entry that is causing trouble, or if you're feeling bold delete the whole file (which contains 100s of entries for me), but be warned apple has this feature in place for your safety so editing preferred.

- DON'T reopen safari (it caches the file). Instead restart your mac.


Now it should work next time you open safari 🙂

Aug 18, 2017 11:10 AM in response to MarkChenFrom北京

It's pretty funny all the complaints about a broken Safari or something like that.


Hey guys, this works as designed. HSTS ensures that if a website provider wants to let browsers know that they only serve secure connections he can do that and the browser saves this for the defined time span. There is nothing you can do about this in the long term as long as the website provider sends HSTS headers. Of course you can delete regularly all HSTS caches in Safari. As you might know there is also a HSTS preload list maintained by Google which is hard coded into many browsers including Safari. If the domain is on that list you won't have any chance to connect to an unsecure HTTP connection.

Dec 8, 2017 8:58 AM in response to ithos

The workaround that worked for me for localhost development was to:


* Temporarily set a really short Strict Transport expiration time in the web server.


In nginx


add_header Strict-Transport-Security "max-age=2; includeSubdomains;";


* Open up Safari to go to https://localhost ...


* Remove the Strict Transport directive and restart nginx.


* Open up Safari to go to http://localhost ...

Safari forcing HTTPS for some HTTP only sites

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.