Skip to content

[2.4.x] core: Do not offer 'h2' via Upgrade on TLS connections. - #837

Open
arturobernalg wants to merge 1 commit into
apache:2.4.xfrom
arturobernalg:backport/httpd-59311-h2-upgrade-tls
Open

arturobernalg wants to merge 1 commit into
apache:2.4.xfrom
arturobernalg:backport/httpd-59311-h2-upgrade-tls

Conversation

@arturobernalg

@arturobernalg arturobernalg commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

Backport of #836 (trunk 2403a34) to 2.4.x.

On a TLS connection httpd announced "Upgrade: h2" to HTTP/1.1 clients.
RFC 9113 section 3.3 requires HTTP/2 over TLS to be negotiated with
ALPN, so ap_get_protocol_upgrades() no longer lists 'h2' when the
connection is TLS. test_h2_103_06 is updated and a changes-entries
file is added.

Clean cherry-pick, same diff as trunk.

Checked on a 2.4.x build with "Protocols h2 h2c http/1.1": the TLS
response has "Upgrade: h2c" (before: "h2,h2c"), the cleartext response
still has "Upgrade: h2,h2c", and h2 over ALPN works.

Not covered here: 'h2c' is still announced on TLS and 'h2' on
cleartext connections. That is left for a follow-up.

Bugzilla: https://bz.apache.org/bugzilla/show_bug.cgi?id=59311

@arturobernalg
arturobernalg force-pushed the backport/httpd-59311-h2-upgrade-tls branch from 945c587 to 71d2a83 Compare November 6, 2026 22:06
@covener covener changed the title core: Do not offer 'h2' via Upgrade on TLS connections. [2.4.x] core: Do not offer 'h2' via Upgrade on TLS connections. Nov 16, 2026
@covener

covener commented Nov 16, 2026

Copy link
Copy Markdown
Member

@arturobernalg conflicts developed

@arturobernalg
arturobernalg force-pushed the backport/httpd-59311-h2-upgrade-tls branch from 71d2a83 to 8b885e3 Compare November 28, 2026 19:29
@arturobernalg

Copy link
Copy Markdown
Member Author

@arturobernalg conflicts developed

Solved @covener

* server/protocol.c (ap_get_protocol_upgrades): Exclude 'h2' from the
  list of protocols announced in the Upgrade response header when the
  connection is already using TLS.  RFC 9113 section 3.3 requires
  HTTP/2 over TLS to be negotiated exclusively via ALPN; offering 'h2'
  through the HTTP/1.1 Upgrade mechanism on TLS is a protocol
  violation that some clients handle poorly.

* test/modules/http2/test_103_upgrade.py (test_h2_103_06): Update to
  assert the corrected behaviour.

* changes-entries/h2-upgrade-tls.txt: Add entry.

PR: 59311

(cherry picked from commit 2403a34)
@arturobernalg
arturobernalg force-pushed the backport/httpd-59311-h2-upgrade-tls branch from 8b885e3 to d356995 Compare November 29, 2026 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants