encode / uvicorn

An ASGI web server, for Python. 🦄
https://www.uvicorn.org/
BSD 3-Clause "New" or "Revised" License
8.57k stars 745 forks source link

Use `X-Forwarded-Proto` for WebSockets scheme when the proxy provides it #2258

Closed aadnehovda closed 8 months ago

aadnehovda commented 8 months ago

Summary

Fix for https://github.com/encode/uvicorn/pull/2043 which set the scheme to ws when the proxy passes wss in X-Forwarded-Proto. Traefik sets the proto to ws/wss for websockets. https://github.com/traefik/traefik/blob/c1ef7429771104e79f2e87b236b21495cb5765f0/pkg/middlewares/forwardedheaders/forwarded_header.go#L148-L153

(please note the code is not tested)

Checklist

Kludex commented 8 months ago

Thanks @aadnehovda 👍