Safari won't load some resources over http/2
Asked Answered
C

4

14

Http/2 is enabled on server and yesterday I noticed that on Iphone (IOS 10.2) does not load some resources with error:failed to load resource:connecting to server is not possible. When I connect Iphone to Mac there are no errors in console but simply result of some requests result imidiatelly in that error. Interesting thing could be the fact that resources which are not loaded are subdomain of real domain( CNAME to be correct). Site is on https. Server is Windows server 2016.

EDIT: We resolved this subdomain problem, but still there are requests from same domain that are not responding with any response.

I know IOS > 9.3 supports http/2 when resources are loaded over https but thing that resources which not working are not part of that domain could help to resolve this problem but I don't know how.

I know that probably problem is related to http/2 protocol because my android native appliacation also stopped working with error : java.io.IOException: stream was reset: PROTOCOL_ERROR . I resolved that problem by forcing my application to use http/1. Now works. But how to resolve that iphone safari problem?

I'm using ASP.NET Web Forms as backend (which supports http2 since ASP.NET 4.6 which I'm using).

Cos answered 6/4, 2017 at 11:24 Comment(4)
Interesting problem you got there. PS: Formatting.Sly
Is your SSL certificate issued for real domain only or is it wildcard certificate for subdomains as well?Aston
Yes, and works for subdomains but I recently noticed that some pages in real domain(not subdomains) do not load. If I open page that is not working in Chrome or Firefox I get response (althought http 1.1) response. Pages that work on Mac on Chrome also work and return http2 response. It it possible that something on my website prevents returning http2 response? Or maybe there is problem with IIS which cant't downgrade requests for same pages?Indisputable
We tried disabling viewstate on top of the problematic ASP.NET WebForms page by adding EnableViewState="false" and it seems it helped in some situations (some pages are opening now), but still without ultimate solution...Indisputable
C
1

It seems that solution has been found. After few days of investigating disabling dynamic content compression helped.

enter image description here

Cos answered 20/4, 2017 at 12:55 Comment(1)
Problem is that you have to do this for the entire website, and are then punished by Google for not being "mobile friendly".Saxen
S
1

The answer has already been correctly provided here above by Vlado Pandžić. I cannot comment as I am new on this site, but I wanted to add something I found.

IOS less than version 11 does support HTTP/2. BUT! It will get stuck if the page is too big and compressed. I'm not sure what the cut-off is, but if you open a small page which has dynamic compression (Gzip or whatever) it will work fine. ASP or PHP etc, doesn't matter. Once the page reaches a compressed data size which requires multiple round-trips to pull the data, then Safari gets it's knickers in a twist.

It will literally go into an endless loop, hammering your server with requests. I was seeing thousands of page hits while Safari was just stuck on a blank white screen.

The problem for me, is that disabling dynamic compression on your entire website will result in penalties from Google for mobile-friendliness. Google wants you to have compression on, but you have to disable it for Safari, which sucks.

My solution to this was the enable dynamic compression on the entire website, but I used web.config file to disable it for specific pages which I know can be quite large in size.

<location path="large-page.aspx">
    <system.webServer>
        <urlCompression doDynamicCompression="false" />
    </system.webServer>
</location>

Good luck!

Matt

Saxen answered 18/1, 2018 at 9:5 Comment(0)
S
0

You can also disable gZip and use brotli instead for compression, older versions of Safari don't support it so it seems to work.

https://github.com/saucecontrol/Brotli-IIS

Semitone answered 25/7, 2018 at 16:27 Comment(0)
R
0

This is quite an old thread, however, there's a better answer if you need don't want to cut off old iOS devices than disabling all compression for either this site (accepted answer) or for all browsers for a given resource (Matt Deemer).

A URL Rewrite rule can disable compression just for the resources and browsers that matter.

Recently, I wanted to move an established Classic ASP site, which can serve large, dynamically created resources, to HTTP/2.

The following rule allowed everyone but old WebKit versions to get the content compressed.

    <rule name="No compression for old WebKit">
          <match url="^(.+\.asp.*)" />
          <conditions>
              <add input="{HTTP_USER_AGENT}" pattern="AppleWebKit\/60[0-3]" />
          </conditions>
          <serverVariables>
              <set name="HTTP_ACCEPT_ENCODING" value="none" />
          </serverVariables>
          <action type="Rewrite" url="{R:1}" />
    </rule>

NOTES: WebKit/604 and greater do not have the http/2 - compression issue.

Ruzich answered 22/2, 2022 at 19:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.