Website OK on Firefox but not on Safari (kCFErrorD

2020-06-16 09:42发布

问题:

Since some days, my website won't load on Safari nor Chrome on Mac OS X (at home nor on my clients computers). It's working well on Firefox (Mac OS & Windows) and IE / Edge, but not Chrome (Windows). It was well working before that and was not updated since weeks.

I'm facing this error on Safari

Failed to load resource: The operation couldn’t be completed. (kCFErrorDomainCFNetwork error 303.)

And this one on Chrome

 Failed to load resource: net::ERR_SPDY_PROTOCOL_ERROR

It seem's to be related to HTTP/2 but I don't really know what is the problem.

I saw that a workaround is to clear the cache and cookie. I did and it works on Chrome the first time I load the website, but when I navigate to another page, the error appear again. I also flush opened socket without effects.

On Safari, flushing the cache and cookie has no effects.

My hoster (OVH) tells me that the problem is in my code but I cannot figure out where could be the bug.

Do you have any clue about that ?

Thanks a lot

回答1:

We have had a problem with nginx and HTTP/2 which resulted in the same error in Safari and a similar error in Internet Explorer.

When we tweaked the nginx buffers to be:

http2_max_field_size 16k; http2_max_header_size 128k;

the issue was gone.



回答2:

My problem was disappearing after reloading the page. So it always shows the error on the first load after nginx reload. Error log shown:

2018/10/21 06:26:54 [crit] 9439#9439: *54 open() "/var/cache/nginx/proxy_temp/2/01/0000000012" failed (13: Permission denied) while reading upstream, client: 37.9.113.93, server: anvileight.com, request: "GET /ar/ HTTP/1.1", upstream: "http://unix:/run/a8/gunicorn.sock:/ar/", host: "anvileight.com"

My problem was that nginx has directive:

user       deploy deploy;

and indeed, permissions on that folder were incorrect:

ll /var/cache/nginx/proxy_temp
total 40K
drwx------ 102 www-data www-data 4.0K Jan  6  2018 0
drwx------ 102 www-data www-data 4.0K Jan  6  2018 1

When I changed it to

user       www-data www-data;

problem has gone



回答3:

The problem is a result of Safari holding too much local data for the site in question and failing to deal with that correctly. I use archive.org a lot so I had lots of LocalStorage and Cookie data for that site. The fact that this data is only in my main browser Safari and not in any of my other browsers explains why they could browse the site just fine.

So, the solution:

  1. Go into Safari > Preferences > Privacy
  2. Search for the affected domain name (for me this was "archive.org")
  3. Click Remove
  4. The problem goes away!

Here's a video showing the problem before and after: https://imgur.com/gallery/d1P1FCi