traefik: websocket with http/2 cleartext lead to http 500
Do you want to request a feature or report a bug?
Bug
What did you do?
traefik terminates http connections with acme LE TLS and proxies tomcat java application. The application uses websockets as well as http. Quite some connections are used concurrently.
In order to optimize http/2 should be used for the java application as well as the traefik entrypoint. For the internal connection no encryption should be used to save cpu cycles and reduce latency (it is a container local network anyway).
If the java application is using ‘http’ scheme, everything works great.
When using ‘h2c’ as schema for the java application, an http 500 is returned by traefik. The debug log shows
level=debug msg="'500 Internal Server Error' caused by: unsupported protocol scheme \"h2c\""
What did you expect to see?
A websocket connection according to RFC 8441
Since there is a testcase specifically for h2 protocol, I wonder what prevents h2c: https://github.com/traefik/traefik/blob/4fccde84bd839afd0f784c3783f2dde7d0f7e8e1/integration/websocket_test.go#L442
What did you see instead?
An http 500 without any logmessage or returned data to the client. (This resulted in some hours debugging, since the assumption was that it was not caused by traefik. )
Output of traefik version
: (What version of Traefik are you using?)
Traefik version 2.3.2 built on 2020-10-19T18:36:22Z
What is your environment & configuration (arguments, toml, provider, platform, …)?
backend:
build:
context: backend
labels:
- "traefik.enable=true"
- "traefik.http.routers.backend.rule=Host(`backend.localhost`)"
- "traefik.http.routers.backend.entrypoints=web"
- "traefik.http.routers.backend.middlewares=backend-strip-prefix@docker"
- "traefik.http.middlewares.backend-strip-prefix.stripprefix.prefixes=/api"
- "traefik.http.services.backend.loadbalancer.server.port=8081"
- "traefik.http.services.backend.loadbalancer.server.scheme=h2c"
About this issue
- Original URL
- State: open
- Created 4 years ago
- Comments: 21 (5 by maintainers)
@everflux better now? 😉
There is some work happening in https://github.com/golang/go/issues/49918 to implement the required foundation in go. It would be great of traefik developers could keep an eye on this to ensure it will work with traefik. (Especially https://github.com/golang/go/issues/49918#issuecomment-1140026815 got me concerned, waiting years to get this feature and it might then just not work for proxy use cases.)