I’m faced with a strange problem on iOS devices when I try to access a website placed behind an Nginx proxy in http/2 with an Apache backend also in http/2.
On iOS devices – and only on iOS devices – I have a ERR_INVALID_RESPONSE displayed on the browser (regardless of the browser used: Safari, Chrome, … All have the same behavior). There is absolutly no problem with desktop browsers (Linux or Windows) or with Android devices. The problem seems to be on the underlaying network stack on iOS devices ?…
Browser <---> Nginx with http/2 <---> Apache with http/2
[ ERR_INVALID_RESPONSE ]
If I disable http/2 on the Apache backend, all is working fine… This behavior is not depending on the website (same problem on many sites with same successfull workaround).
Browser <---> Nginx with http/2 <---> Apache with http/1.1 (http/2 DISABLED)
[ OK ]
It seems that I’m not the only one with this problem (https://community.ovh.com/t/resolu-vps-sous-plesk-site-innaccessible-sous-iphone-et-ipad/42227)
But except to disable http/2 on the Apache backend, I don’t find any explanation of the root cause of the problem.
Any ideas ?…
2
Answers
Solution and root cause found here : https://serverfault.com/questions/818535/nginxapache2letsencrypt-with-iphone-cannot-display-page
iOS 10+ doesn't support having an
Upgrade
header in the response if original request is already in http/2. The solution is to hide theUpgrade
header provided by the Apache server due to the upgrade of the Nginx to Apache request (Nginx send an http/1.1 request witch is upgraded in http/2 by Apache).I was getting
ERR_INVALID_RESPONSE
in iOS Safari, but "cannot parse response" in iOS Chrome.Same: reverse proxy Nginx-Apache server.
Per a non-accepted answer on the above link, I changed nothing in HTTP/2, only added this line in the Nginx config and restarted:
Inside this statement:
Add this line: