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

Allow customising ProxyAddHeaders #953

Merged
merged 1 commit into from
May 12, 2021
Merged

Conversation

nbarrientos
Copy link
Contributor

@nbarrientos nbarrientos commented May 12, 2021

When the Apache instance configured by this module is not dealing with user requests directly because there's another proxy in front, it's undesirable that the "local" Apache resets headers like X-Forwarded-Host. When it does, it could happen that links created using Rails _url helpers do not contain the Host initially sent by the client leading to broken links (as they point to backend nodes not reachable by the user).

This patch makes this setting customisable by the administrator by exposing it as parameter.

Fixes #952

When the Apache instance configured by this module is not dealing with
user requests directly because there's another proxy in front, it's
undesirable that the "local" Apache resets headers like
X-Forwarded-Host. When it does, it could happen that links created
using Rails _url helpers do not contain the Host initially sent by the
client leading to broken links (as they point to backend nodes not
reachable by the user).

This patch makes this setting customisable by the administrator by
exposing it a parameter.

Fixes theforeman#952
Copy link
Member

@ekohl ekohl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For what it's worth, you don't need to open an issue for a PR. A PR with a good description is sufficient.

@ekohl ekohl merged commit 20d5184 into theforeman:master May 12, 2021
@nbarrientos
Copy link
Contributor Author

Thanks, next time I'll just send a MR. It used to be mandatory to have an issue for any code contribution to Foreman itself, that's why :)

@ekohl
Copy link
Member

ekohl commented May 14, 2021

I was reading more documentation and wanted to capture it. There's ProxyPreserveHost:

When enabled, this option will pass the Host: line from the incoming request to the proxied host, instead of the hostname specified in the ProxyPass line.

This option should normally be turned Off. It is mostly useful in special configurations like proxied mass name-based virtual hosting, where the original Host header needs to be evaluated by the backend server.

Perhaps this is what you're looking for?

Another is mod_remoteip which may also be useful.

@nbarrientos
Copy link
Contributor Author

Thanks! Not (re-)setting any X-Forwarded-* header at all (by setting ProxyAddHeaders to Off) on the second Apache is just enough for us, this way Foreman also sees for instance X-Forwarded-For which is I believe consumed by the audit logs.

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

Successfully merging this pull request may close these issues.

Allow customising ProxyAddHeaders
3 participants