You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
It is possible to enable HTTP2 support in Spring Boot application like so:
server.http2.enabled=true
with this enabled and with embedded Tomcat running in HTTPS mode (at port 8443), the browsers (like Chrome) use the HTTP2 (shown as h2 in protocol column of Chrome devtools network panel), and due to the specs related to HTTP2 do not send the Host: localhost:8443 header. Instead the browsers send :authority: localhost:8443.
relies on the Host: header and if not found uses the host and scheme from URI. The port is not set at all.
However there is code in Tomcat that does process the :authority: header and sets the values of req.getServerName() and req.getServerPort().
Describe the solution you'd like
The computation of forwarded: header should make use of values of req.getServerName() and req.getServerPort() because they are set from :authority: header, which is equivalent of Host: when HTTP2 is being used.
Describe alternatives you've considered
None.
Additional context
BTW libraries like HATEOAS rely on Host: header to return correct links in the response.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
It is possible to enable HTTP2 support in Spring Boot application like so:
server.http2.enabled=true
with this enabled and with embedded Tomcat running in HTTPS mode (at port 8443), the browsers (like Chrome) use the HTTP2 (shown as h2 in protocol column of Chrome devtools network panel), and due to the specs related to HTTP2 do not send the
Host: localhost:8443
header. Instead the browsers send:authority: localhost:8443
.The code here:
spring-cloud-gateway/spring-cloud-gateway-mvc/src/main/java/org/springframework/cloud/gateway/mvc/ProxyExchange.java
Line 418 in 51367a8
relies on the
Host:
header and if not found uses the host and scheme from URI. The port is not set at all.However there is code in Tomcat that does process the
:authority:
header and sets the values ofreq.getServerName()
andreq.getServerPort()
.Describe the solution you'd like
The computation of
forwarded:
header should make use of values ofreq.getServerName()
andreq.getServerPort()
because they are set from:authority:
header, which is equivalent ofHost:
when HTTP2 is being used.Describe alternatives you've considered
None.
Additional context
BTW libraries like HATEOAS rely on Host: header to return correct links in the response.
The text was updated successfully, but these errors were encountered: