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

Pass original port in all proxied queries #479

Open
rayrapetyan opened this issue Aug 3, 2024 · 0 comments
Open

Pass original port in all proxied queries #479

rayrapetyan opened this issue Aug 3, 2024 · 0 comments

Comments

@rayrapetyan
Copy link

Feature request

Feature description

Currently in a reverse proxy generated section proxied port looks as below:

proxy_set_header X-Forwarded-Port  $server_port;

$server_port is the port nginx is listening on, which is not always the same port UA connects to (e.g. when nginx is listening inside a docker container on port 80, but UA connects to localhost:8080).
IMO we should pass here the original port UA connects to, e.g. for http://localhost:8080 X-Forwarded-Port should be 8080. For this, a solution from https://stackoverflow.com/a/63366106/1017293 can be used, e.g. we need to add:

map $http_host $orig_port {
    default $scheme;
    "~^[^\:]+:(?<p>\d+)$" $p;
}

into http section of the nginx.conf and then in the proxy.conf use:

proxy_set_header X-Forwarded-Port  $orig_port;

How the feature is useful

Most of OAuth providers and any other server-side redirect solutions will work as expected.

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

No branches or pull requests

1 participant