You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is really bad code and does everything very wrong, sorry about that, it's just a proof-of-concept. I just submitted this because it took me a while to figure it out already, and people seemed interested in #58 (5 upvotes at the time of writing).
Supports:
tokio runtime
monoio runtime
TCP connections
QUIC connections
It's very quick & dirty, as it will peek in the stream to find the TLS handshake (i couldn't find a peek equivalent in monoio, so only tokio is supported for now), which will be parsed a second time if the connection is not reverse proxied without TLS termination.
Also, i mostly have no idea what i'm doing with that backend TcpStream reading/writing, i just hacked this around, but i'm guessing it's possible to pipe actual tcp_stream into dest_stream without dark magic (i just don't know how).
Testing
It's using the proxy_tls directive in vhosts. For example:
it's very cumbersome to get SNI from rustls without consuming the connection (hence the peeked buffer hack), there's plenty of issues about it upstream, and i don't understand why the maintainers don't want to make it easier (i had to fork rustls to make more types public, but there may be a simpler way)
Hello @DorianNiemiecSVRJS, i'm still interested in this feature even though this PR is indeed stale! I can rebase on 3.x given some guidance on the new codebase. From what i can read there's now a hinted_hostname that's extracted from SNI on TCP/quic connections. Does that mean that 3.x already implements SNI-aware reverse-proxying? Or should i still update this PR to add the actual setting?
Hello @DorianNiemiecSVRJS, i'm still interested in this feature even though this PR is indeed stale! I can rebase on 3.x given some guidance on the new codebase. From what i can read there's now a hinted_hostname that's extracted from SNI on TCP/quic connections. Does that mean that 3.x already implements SNI-aware reverse-proxying? Or should i still update this PR to add the actual setting?
Your PR would implement SNI-aware L4 proxying (if I read it correctly), but Ferron 3's reverse proxy implements L7 proxying, which would require a TLS certificate for the proxy.
Yes, you can optionally close this PR and create a new one against the develop-3.x branch. And yes, hinted_hostname in http-server is derived from SNI hostname.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is really bad code and does everything very wrong, sorry about that, it's just a proof-of-concept. I just submitted this because it took me a while to figure it out already, and people seemed interested in #58 (5 upvotes at the time of writing).
Supports:
It's very quick & dirty, as it will peek in the stream to find the TLS handshake (i couldn't find a peek equivalent in monoio, so only tokio is supported for now), which will be parsed a second time if the connection is not reverse proxied without TLS termination.
Also, i mostly have no idea what i'm doing with that backend
TcpStreamreading/writing, i just hacked this around, but i'm guessing it's possible to pipe actualtcp_streamintodest_streamwithout dark magic (i just don't know how).Testing
It's using the
proxy_tlsdirective in vhosts. For example:Now you can curl it:
Additional notes
rustlswithout consuming the connection (hence the peeked buffer hack), there's plenty of issues about it upstream, and i don't understand why the maintainers don't want to make it easier (i had to fork rustls to make more types public, but there may be a simpler way)