Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 6 commits into from Mar 1, 2024

Conversation

aadnehovda
Copy link
Contributor

Summary

Fix for #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

  • I understand that this PR may be closed in case there was no previous discussion. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.

Minor fix for encode#2043

Traefik already sets the X-Forwarded-Proto headers to ws or wss for websockets. https://github.com/traefik/traefik/blob/c1ef7429771104e79f2e87b236b21495cb5765f0/pkg/middlewares/forwardedheaders/forwarded_header.go#L150

This change should make sure we don't overwrite those values.
Test whether passing "wss" in X-Forwarded-Proto works
(probably more ways to write this... lmk which you prefer)
@Kludex Kludex changed the title Use X-Forwarded-Proto for websockets scheme when the proxy provides it Use X-Forwarded-Proto for WebSockets scheme when the proxy provides it Mar 1, 2024
@Kludex Kludex enabled auto-merge (squash) March 1, 2024 08:18
@Kludex
Copy link
Sponsor Member

Kludex commented Mar 1, 2024

Thanks @aadnehovda 👍

@Kludex Kludex merged commit 0d4747e into encode:master Mar 1, 2024
15 checks passed
@aadnehovda aadnehovda deleted the patch-1 branch March 6, 2024 10:53
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.

None yet

2 participants