4

At first, I don't own an iPad but some clients reports some weird problem with a website of mine on the iPad. They cannot open any page on the website, they end up with a blank page with the message: "Safari cannot open webpage as it is not connected to internet".

The message is a kind of weird because the user can open other websites and they are connected to the internet. Sometimes you will see the webpage for a split second and then the same message.

Yesterday a friend of mine (he is not a programmer) brings his iPad 3 with IOS7 to test it but we cannot figure out what the problem is because Safari do not share some debug info (at least you need a mac to see debug info and I don't own a mac either).

I test the same version of the website locally on a Windows machine to be sure it is not a hosting problem. The same error on iPad Safari, so there is a problem with the served files.

The website is programmed with PHP. What I have tested so far (and didn't lead to solution):

  • Safari: Turn off Cookies and Javascript
  • Safari: Empty cache several times
  • PHP: Turn off sending header info (disable all customized cache headers)
  • PHP: Turn off customized CSS for browser
  • PHP: Turn off embedding of sprites (base64 data embedding)
  • PHP: Turn off minifying of HTML

The problem is still there. It is very difficult to test what is going wrong without any debug info of Safari, can somebody see what going on in the safari browser that cause this error?

The website: http://www.meezingeninrotterdam.nl

And does this error also occur on the MAC version of Safari?

EDIT: Report the error to Apple: Apple Safari Error Bug Report

UPDATE:

Think I find the reason, see also my solution. If you have an iDevice, do you want to test it to confirm? See my solution below.

UPDATE 2

See answer, answer from Apple. No solution. If you know the solution or workaround, please let me know.

Codebeat
  • 6,501
  • 6
  • 57
  • 99

8 Answers8

6

I was having this issue where Safari would return the message Safari cannot open the page because the network connection was lost. My client was having the issue but it was working fine for me. I was eventually able to replicate the issue using the iOS Simulator for an iPhone 7 on iOS 10.2.

The server is running Ubuntu 14.04 (trusty) using nginx 1.4.6 and the site is using a SSL/TLS cert from Let's Encrypt.

I monitored the error log using sudo tail -f /var/log/nginx/error.log

Each time I refreshed the site in the iPhone simulator, it generated three new error messages on the server:

2016/12/22 17:48:39 [alert] 8071#0: worker process 12812 exited on signal 11 (core dumped)
2016/12/22 17:48:39 [alert] 8071#0: worker process 12848 exited on signal 11 (core dumped)
2016/12/22 17:48:40 [alert] 8071#0: worker process 12846 exited on signal 11 (core dumped)

After some digging it turns out there's a bug with how nginx talks to OpenSSL.

Obvious workaround is to use the same session cache for all server blocks, e.g. to configure it on the http{} level.

We had the following ssl_session_cache option set in each virtual host's server scope in /etc/nginx/sites-available/:

ssl_session_cache shared:SSL:50m;

I removed this configuration line from each of the virtual host configurations under /etc/nginx/sites-available/ and added it back under the http scope in the main /etc/nginx/nginx.conf config file.

After restarting nginx with sudo service nginx restart, the problem was resolved for us. :)

SammyK
  • 983
  • 11
  • 20
  • 1
    We had the exact same issue, and this is the correct fix. Move `ssl_session_cache shared:SSL:10m; ` to the HTTP block, not in each server block. This post is old but in December 2020, this still is the issue with Nginx 1.19 AND iOS 14 Safari! Very hard issue to track so I am so thankful for this insight. – Manabu Tokunaga Dec 26 '20 at 02:20
1

I can confirm that this is broken on my iPhone 5S in iOS7. I will say that in Safari on Mac I am receiving the following warning:

"4event.layerX and event.layerY are broken and deprecated in WebKit. They will be removed from the engine in the near future."

Not sure if that is your problem or not, but that is the only error I see on safari for mac.

I hooked the phone up to my mac and tried using the developer console...The only errors I am seeing are:

Failed to load resource: the network connection was lost Invalid CSS property declaration #FF0000 in general.css

Hope something in there helps. The only thing else I could think is that maybe your server is sending a header that iOS7 doesn't like.

kevindeleon
  • 1,914
  • 3
  • 18
  • 30
  • Hai you both, thanks for the details! I fixed the CSS and check it for errors with csslint and found another two. But if this doesn't help, could be the problem the webfonts I using? Thanks for the quick response, really appreciate it! – Codebeat Oct 13 '13 at 00:47
  • If you want to test it again, I really appreciate it because I don't have a Mac of iDevice. – Codebeat Oct 13 '13 at 01:00
  • No more CSS errors and no more 4event error, but still failing in iOS7. I would say this has to be something coming from your server that iOS7 doesn't like. Sorry man, I'd do some Googling and see what you come up with. Sounds like it is likely a bug in iOS. – kevindeleon Oct 13 '13 at 01:10
  • Thanks for testing. Yes, it is really a bug in iOS and it is there since the latest update of iOS6. It could also a problem in the TCP/IP stack, that cause the server sending "Connection reset by peer". But I like to know what causing this so I can implement a work-around. Maybe the used webfonts? I have removed the webfonts now. – Codebeat Oct 13 '13 at 01:26
  • You are likely going to have to get a response from Apple somehow to solve this. I do not see anything strange in the request/response headers...Are you using a proxy by any chance? Maybe some sort of caching mechanism? If so, that could be hosing it up. You may want to try contacting your hosting company/server administrator. – kevindeleon Oct 13 '13 at 02:12
  • Thanks for testing. I don't think it is a server problem because I have test it here locally on another server (windows) and shows the same problem. I turned off caching before and doesn't solve the problem. As you can see, I reported this problem to Apple. – Codebeat Oct 13 '13 at 13:25
1

I can also confirm the same errors in Safari for Mac:

4event.layerX and event.layerY are broken and deprecated in WebKit. They will be removed from the engine in the near future."

Looks like a jQuery / webkit issue you're having? Take a look at this post over here regarding the same thing...

WebKit issues with event.layerX and event.layerY

Also, when I open the site on my iPhone 5 running iOS7 in Safari, I get this error:

Safari cannot open the page because the network connection was lost.

If I open it in Chrome on the iPhone, it says:

The webpage is not available

Hope all that info helps... looks like a definite code issue with some properties on the site... or the way jQuery is being used.

UPDATE

Looking through your CSS code, I think the problem may be some bad CSS the browsers don't like. This line has a problem:

.dialog .error .err{color:#FFF;text-shadow:0px 0px 10px; #FF0000;padding:0 0 0 2px;clear:both;}

Look at the section I have in bold. You have a color specified but no matching property with it. I can't say that's the ONLY problem... but fixing that would be a good start.

Community
  • 1
  • 1
Charlie74
  • 2,883
  • 15
  • 23
  • BTW @Erwinus if you get the CSS on the site fixed, comment back here and I'll give the updated site a try on the iPhone. – Charlie74 Oct 13 '13 at 00:27
  • Hai you both, thanks for the details! I fixed the CSS and check it for errors with csslint and found another two. But if this doesn't help, could be the problem the webfonts I using? Thanks for the quick response, really appreciate it! – Codebeat Oct 13 '13 at 00:46
  • I use jQuery an older one, version 1.5.1. The reason for this is that this version works best for some plugins, existing code and IE9. – Codebeat Oct 13 '13 at 00:50
  • If you want to test it again, I really appreciate it because I don't have a Mac of iDevice. Notice: Chrome does not really differs that much from Safari because they using the same version/engine of webkit because Apple does not allow another engine than installed engine. – Codebeat Oct 13 '13 at 01:00
  • Just gave it a try on my iPhone. Same problem in both browsers. Could be the jquery version you are using. The post I linked above says this problem was fixed in a later build. 1.7x or something. Not sure that will fix the display issue on mobile, but might be worth looking in to. – Charlie74 Oct 13 '13 at 01:06
  • Thanks for testing again. It is not the jQuery version because I have tested without Javascript turned on. I will remove the webfonts, maybe that cause the problem. Have removed it now. – Codebeat Oct 13 '13 at 01:09
  • Hmmm FWIW, I just tried your site in the Google app's internal browser on my iPhone, and that works fine. So it's not an iPhone issue per say... but rather something to do with mobile webkit browsers it appears (both Safari and Chrome have the same webkit base). – Charlie74 Oct 13 '13 at 01:27
  • What is FWIW? Yes, the site works perfectly on my Android device or any other browser. Can you see any errors that the server returns? – Codebeat Oct 13 '13 at 01:32
  • Worked in Chrome for iOS. No luck for me in Safari. Might just need to clear cache or something. But at least it's working in Chrome. Looks like you are on the right track? – Charlie74 Oct 15 '13 at 02:32
  • Ah, thanks Charlie. It is very hard to clear the cache in iOS7. A friend told me that it is still not working on his iPad 3 with IOS7 but could be a cache problem. Test it today on a iPad 1 and works perfectly. – Codebeat Oct 15 '13 at 08:18
0

I had this same problem on one of my own sites. I noticed that it worked on my development server, and that it was running a newer version the FastCGI (2.4.7 vs. 2.4.6) module. As a shot in the dark, I installed the newer FastCGI 2.4.7 on my production system and it solved the problem.

If you aren't using FastCGI, maybe the changelog will at least point you in the right direction: http://files.directadmin.com/services/custombuild/mod_fastcgi-2.4.7/CHANGES

Aaron Hall
  • 1
  • 1
  • 1
  • Thanks for your try to help. I don't think so it has something to do with this because errorpages on the site show up normally. Test it also on my local development server and same behaviour. – Codebeat Oct 14 '13 at 19:44
  • Erwinus: I found that some error pages worked for me, too. I should have noted that. For me, it seems to be some strange interaction between FastCGI and the framework (Perl Dancer + Plack) that I was using. It so happened that upgrading FastCGI worked for me. Good luck finding your solution. – Aaron Hall Oct 15 '13 at 03:05
  • But i still believe the error is in iOS7 because today test the site on a iPad 1 and the site just works fine. – Codebeat Oct 15 '13 at 08:11
0

All right, think I got it but must be confirmed by Apple iDevice users since I didn't own such device.

I get access to the error log files on the server. There are some interesting lines to find, such one as this:

[error] [client 81.204.47.42] mod_security: Access denied with code 500. Pattern match "Mozilla/(4|5)\\\\.0$" at HEADER("USER-AGENT") [hostname "www.meezingeninrotterdam.nl"] [uri "/data:image/x-icon;base64,AAABAAEAICAAAAAAAACoCAAAFgAAACgAAAAgAAAAQAAAAAEACAAAAAAAgAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////ACCB2AA/TVgAjMPXAG ... etc etc

The favicon in the html page is base64 encoded, but Safari on the iDevice tries to load it from the server. Such encoded icon works perfectly on a old Safari version for Windows for example. Because in the URL you see path slashes (for example the string '////'), the server sees this as an abnormal encoding and throws an internal server error (code 500).

This doesn't have to be a problem when not the base content such as the html file throws this error. This is a serious bug in Safari, when one piece (file that belongs to the page) of the page throws a 500 error it doesn't display the whole page.

I have not tested this yet because I don't own an iDevice. I want also test it with a page that throws a 500 error to check if the same error message ("Safari cannot open webpage as it is not connected to internet") appear on Safari. When true, it is a stupid message because there is an internet connection but only the page is not accessible.

I have removed the base64 encoded favicon and apple-touch-icon from the page so I think it must load normally now.

Can somebody with an iDevice (iPad/iPhone etc) confirm this? If it loads normally, the case description of above is the problem.

Website address is: http://www.meezingeninrotterdam.nl (don't forget to refresh the content if you have been there once).

Codebeat
  • 6,501
  • 6
  • 57
  • 99
0

Oh really, now I know it for sure, Apple support sucks.

This is the e-mail I received today in my mailbox.

Hello Erwinus,

Engineering has determined that your bug report is a duplicate of another issue and will be closed. 

The open or closed status of the original bug report your issue was duplicated to appears in the yellow "Duplicate of XXXXXXXX" section of the bug reporter user interface. This section appears near the top of the right column's bug detail view just under the bug number, title, state, product and rank.

Example:

13556600 User interface anomaly in OS X

State: Duplicate                   Product: OS X
Rank: 3 - Medium
---------------------------------------------------------------
Duplicate of 10535951 (Open)
---------------------------------------------------------------

Okay, now I know it is a bug but what kind of workaround can I use? Nope, no answer. When I search for the issue ID #10535951 in the Bug Reporter it cannot find it!

This is the answer my friends, don't waste your time register and to report a bug to help these guys.

Problem unsolved!

If you know a workaround or a solution better than this awful piece of support, please let me know.

Codebeat
  • 6,501
  • 6
  • 57
  • 99
0

Is there any chance that you're using gzip compression for your pages? I had a similar issue where my CSS would appear for a split second on mobile Safari on iOS 7, but then I'd get the error "Safari cannot open the page because the network connection was lost."

Once I turned off gzip compression for my site, the page started working fine again.

It's a long shot, but it's worth a try.

bbrinck
  • 416
  • 4
  • 4
  • Hi thanks for your reply. Yes, i'm using gzip compression for all content. If I got time to test it, I will let you know what the results are. I want to ask to you, do you know this is a bug or another problem (combination of things?). – Codebeat Dec 02 '13 at 10:21
0

I've stumbled upon the similar problem today. Safari was unable to open my https website on Mac and iPhone as well, but other browsers open it pretty good. Safari resets the connection and shows the message like this "Safari can't open the page because the network connection was reset" The problem was solved by adding this line

ssl_session_cache shared:SSL:1m;

to nginx config file in the "server {..}" block

  • Hai thanks for an answer after all this time. It is clear it's a browser bug, for sure. However, I didn't use https but http and doesn't use nginx but Apache. In fact, it's kinda silly to need to change the server config to 'solve' an issue of only one browser. But hay, thanks for the tip, your effort, anyway. – Codebeat Nov 08 '17 at 15:09