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

Default "proxy_set_header Host $host" causing 503 issues in combination with proxy_pass directives #1504

Open
kwisatz opened this issue Jul 14, 2022 · 0 comments

Comments

@kwisatz
Copy link

kwisatz commented Jul 14, 2022

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 7.8
  • Distribution: Debian
  • Module version: 3.3.0
  • Nginx 1.18 and 1.22

How to reproduce (e.g Puppet code you use)

What are you seeing

The default setting for $proxy_set_header is causing 503s in combination with a proxy_pass directive.
Specifically the generated config line proxy_set_header Host $host; inside nginx.conf is causing this problem.

The same line with a static value instead of a variable is not causing the issue and I also believe that the same configuration used to work on an nginx 1.14.

The upstream in this case has not changed, only the client has changed (upgrade from nginx 1.14 to 1.22).

Any additional information you'd like to impart

This might not strictly be a puppet module issue, but the fact that is sets this directive by default (whereas a standard nginx installation does not) means that we should be aware of the problem.

I have mitigated the problem by redefining the proxy_set_header parameter removing the Host header.

nginx::proxy_set_header:
  - 'X-Real-IP $remote_addr'
  - 'X-Forwarded-For $proxy_add_x_forwarded_for'
  - 'X-Forwarded-Host $host'
  - 'X-Forwarded-Proto $scheme'
  - 'Proxy ""'

The following serverfault thread might be related: https://serverfault.com/questions/1069729/nginx-reverse-proxy-proxy-pass-leads-to-503-service-unavailable

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