Skip to content

ngx_stream_pass_module: add an option to allow keeping the incoming stream server_port #686

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

Open
linsite opened this issue May 9, 2025 · 2 comments
Assignees
Labels

Comments

@linsite
Copy link

linsite commented May 9, 2025

Describe the feature you'd like to add to nginx

With ngx_stream_pass_module, one can pass a connection directly from stream to a http server. For now, the passed connection into http context will see the http server_port instead of the real incoming stream server_port.

When a HTTP request can come from both the http server and stream server, one may want see the incoming stream server_port, so one can tell where the request is coming from.

Describe the problem this feature solves

For now there is no such option. Connections' local_addr is forced to set to the http server listening address.

Additional context

A simple boolean option can be added to pass directive.

@linsite linsite added the feature label May 9, 2025
@arut
Copy link
Contributor

arut commented May 16, 2025

Indeed the target sockaddr is set to the connection before passing. This is viewed as a feature since the connection looks like a native connection at the destination. Currently it seems like there's no way to tell if the connection has been passed from another port, except if it's passed to a special port. I'll think about a way to tell that. It can be a directive to keep the original port, or for example a variable is_passed.

@arut arut self-assigned this May 26, 2025
@linsite
Copy link
Author

linsite commented May 29, 2025

Indeed the target sockaddr is set to the connection before passing. This is viewed as a feature since the connection looks like a native connection at the destination. Currently it seems like there's no way to tell if the connection has been passed from another port, except if it's passed to a special port. I'll think about a way to tell that. It can be a directive to keep the original port, or for example a variable is_passed.

Thanks for your reply, Roman. I'm available for those tests, please let me know if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants