Safari ajax request Failed to load resource: The n

2019-02-06 04:20发布

问题:

I'm receiving a message "Failed to load resource: The network connection was lost." in my application, which uses ajax requests to get content from server. This error is only in Safari, other browsers are ok.

I was searching last few hours and found that it can be due to http headers:

Transfer-Encoding : chunked
Connection: keep-alive
Content-Length

I've found something similar: https://github.com/woothemes/woocommerce/issues/7176 On the bottom is told that they set

BrowserMatch "Safari" nokeepalive
in .htaccess.

Is there any similar solution or settings for nginx server?

Thank you

JF

回答1:

One of the reasons why it might happen is the way Safari handles some SSL certificates (mainly, LetsEncrypt). The solution is to put the line:

ssl_session_cache shared:SSL:10m;

to your nginx config.

Source: https://community.letsencrypt.org/t/apple-safari-browsers-fail-to-connect/3731/3