-
Notifications
You must be signed in to change notification settings - Fork 380
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
Valid upgrade path detection requires dual / #346
Comments
Hello, By default, if the user does not specify anything, the path prefix is
So you only need your reverse proxy to rewrite the url from Out of curiosity, what kind of service are you providing to your clients that you are in need of wstunnel ? |
Ahh, I tried to find it in code and thought it was empty. Yea, we currently have This leads to a request on Your pointer to the default being v1 makes sense. But I prefer my mental model over yours :o We are using it to tunnel grpc(http2) connections through middleboxes we don't control, which do not support anything newer than http1. |
My mental model being, I think the entire specified prefix should be possible to strip. Though judging from other features, it's partially intended to be used in tandem with the prefix filter on the frontend to use it as symmetric secret. yea, if you don't like the proposed change, I can just do a different rewrite on the server. |
indeed it is supposed to work as a shared secret between client and server, so it is mandatory when restriction is on. I will go with letting you change the rewrite rule of your reverse-proxy 😉 |
In anycase, thank you for trying to debug your issue and understand the codebase 🙏 |
Describe the bug
When we setup a reverse proxy with a subpath and remove the prefix on the server side, the wstunnel server portion gets confused because it get's the path
/events
, which is not valid.After looking at the code a bit, I found
wstunnel/src/tunnel/transport/websocket.rs
Line 238 in 18db0a7
//events
when there is no prefix set.This allowed the implementation, to rely on having at least 2 slashes in the path, even if they are only 1 path separator.
wstunnel/src/tunnel/server/utils.rs
Line 71 in 18db0a7
To Reproduce
Run wstunnel server side behind a reverse proxy that strips the path.
E.g. we run different versions (a 9.x and a 10.x for different clients) and provide
-P /wstunnel
and-P /wstunnel-10
to the respective clients.The result is
//wstunnel/events
on the server.The reverse proxy rewrites this to
/events
by dropping/wstunnel
, as path segment.Expected behavior
The server component should allow clients that reach it with
/events
. Since it is equivalent to//events
as path.Your wstunnel setup
Paste your logs of wstunnel, started with
--log-lvl=DEBUG
, and with thecommand line used
Desktop (please complete the following information):
Additional context
Getting it started with the debug flags is a bit hard in our setup, but I hope pointing to the code helps here.
I can likely provide a PR to fix this myself soon™
I think the client should retain the doubling behaviour, to not break old systems, but the server should be a bit more permissive/not require an empty path segment, but allow path normalization along the way.
The text was updated successfully, but these errors were encountered: