Safari and Chrome Connection Issues on iPhone with http/2 via AWS Load Balancer
13th February 2020,
13th February 2020,
If you are having problems getting Safari and Chrome on iOS to connect to your site and you're using an AWS Application Load balancer, you might want to check if you have http/2 enabled on the load balancer. If you do, and you're using Apache, try adding the following line to your .htaccess file.
This tiny little line could make the difference between your site working and a large number of users being completely blocked from accessing it.
Http/2 is the brand new version of the protocol that the Internet runs on, and this major new release was launched back in 2015. It has loads of advantages over Http1.1 including performance and security. You can read all about it here in this very thorough article. Needless to say, it's a good thing if you can enable it on your site.
Why this weird issue with some browsers? This Stack Overflow post explains what's going on.
An endpoint MUST NOT generate an HTTP/2 message containing connection-specific header fields; any message containing connection-specific header fields MUST be treated as malformed (Section 188.8.131.52).... connection- specific header fields, such as Keep-Alive, Proxy-Connection, Transfer-Encoding, and Upgrade
So the workaround appears to just be to remove the Upgrade header set by Apache and just rely on the load balancer to handle things.
The above issue isn't always as obvious as you might think either as sometimes it's only certain images which don't load. We've certainly found in our office some of us with iPhones can see a site fine, whilst others have issues. The most recent time we came across the issue, iPhone 8 and iPhone 10 users had a problem whilst iPhone 11 and iPhone 8 Plus users were fine, but it doesn't always seem to be dependent on the model of iPhone or operating system. So if your users are asking "why doesn't your website work on safari on an iphone" or "why are images not showing on safari" or reporting "site not loading on chrome on my phone" then you might want to check out the above and test on a variety of phones to be sure as it does seem a little intermittent.
Want to share? Tweet it!