Skip to content

doc/manual: correct nginx reverse proxy example #1487

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

Merged
merged 1 commit into from
May 27, 2025

Conversation

tomjnixon
Copy link
Contributor

  • hydra does not remove the base URI from the request before processing it, so this must be done in the reverse proxy. in nginx this is done by giving proxy_pass a URI rather than a protocol/host/port; see:

    https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass

  • proxy_redirect is not correct/required: hydra uses proxy headers to correctly form redirects in most cases, and where it doesn't it produces local redirects which aren't matched by this directive anyway

I've tried this exact setup on both http and https, and it works fine (apart from the redirects). It might also be worth showing how to configure this in nixos, as the defaults work and that's probably more relevant to most users?

There is an existing PR for this, #1310 , which i didn't see before making this. This one is a bit more thorough, so seems worth keeping. This is orthogonal to #1202 , which is also a good idea IMO.

- hydra does not remove the base URI from the request before processing
  it, so this must be done in the reverse proxy. in nginx this is done
  by giving proxy_pass a URI rather than a protocol/host/port; see:

  https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass

- proxy_redirect is not correct/required: hydra uses proxy headers to
  correctly form redirects in most cases, and where it doesn't it
  produces local redirects which aren't matched by this directive anyway
@Ericson2314
Copy link
Member

CC @Mic92, I don't know nginx so well

@Mic92
Copy link
Member

Mic92 commented May 27, 2025

@Mic92 Mic92 added this pull request to the merge queue May 27, 2025
Merged via the queue into NixOS:master with commit 2e3c168 May 27, 2025
1 check passed
@tomjnixon
Copy link
Contributor Author

thanks!

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.

3 participants