I have a website on a shared host, responding with these HTTP headers on each page request:
HTTP/1.1 200 OK
Date: Thu, 21 Sep 2017 14:34:46 GMT
Server: Apache
X-Powered-By: PHP/5.6.31
Access-Control-Allow-Origin: *
Upgrade: h2,h2c
Connection: Upgrade, Keep-Alive
Keep-Alive: timeout=5, max=400
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8
As you note, there is the Upgrade
header that is an announce from Apache about the support of HTTP2 protocol.
For some reason, I need to disable this behavior of Apache, in order to send responses without the Upgrade
header.
Who knows how to disable it from the .htaccess file? I've already found this solution:
Header unset Upgrade
But it's not the good one, since sometimes I need to output a custom Upgrade
header from my code (needed to broadcast a firmware upgrade to some thermal printer devices).
Thanks
Try turning it off with this config: https://httpd.apache.org/docs/2.4/mod/mod_http2.html#h2upgrade.
Alternatively, for a .htaccess only solution, use the Header edit
functionality:
Header edit Upgrade (.*)h2,h2c(.*) "$1$2"
Note this may leave you with an empty upgrade header, and you may have to change the config depending on what exactly is shown by your server (e.g. extra commas).