Secure websocket connection to SpringBoot fails with 403 if behind Traefik

Hi guys, my web frontend connects to a websocket served from my backend (SpringBoot app). When I run on local dev setup (without Traefik) everything works fine. The frontend creates a connection to e.g. wss://www.example.com/ws/connect. SpringBoot checks the incoming connect request for same origin. It correctly sees the incoming request for:
scheme: https
port: 443
host: www.example.com

and origin:
scheme: https
port: 443
host: www.example.com

On the live setup, I have the SpringBoot app running behind Traefik, so all http/https traffic goes through Traefik to the app. Now when the websocket connect request comes in, SpringBoot sees request for:
scheme: http
port: 443
host: www.example.com

and origin:
scheme: https
port: 443
host: www.example.com

As you can see, everything is correct except the request scheme, which is http and not https, so the same origin policy fails and the frontend gets a 403 response.

It would seem to me that Traefik is making a mistake here?

Any help would be appreciated.

Hmm, seems the problem was that Spring needs to check the X-Forward-Proto header which is set by Traefik to wss. Sorry for the false alarm :see_no_evil: