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

Reverse Proxy Headers #77

Open
NebulaMods opened this issue Dec 30, 2024 · 4 comments
Open

Reverse Proxy Headers #77

NebulaMods opened this issue Dec 30, 2024 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@NebulaMods
Copy link

An option to enable in the upstream so it will automatically include the "X-Forwarded-For" header, and other headers etc.

@vicanso
Copy link
Owner

vicanso commented Dec 31, 2024

You can set http request header in location:

proxy_set_headers = [
    "X-Forwarded-For:$proxy_add_x_forwarded_for",
    "X-Real-IP:$remote_addr",
]

@vicanso vicanso self-assigned this Jan 1, 2025
@vicanso vicanso added the question Further information is requested label Jan 1, 2025
@NebulaMods
Copy link
Author

@vicanso It still would be nice to have this as an option to toggle these headers on the upstream level instead of having to manually add them for every new location added. Even a toggle would be nice in the location options, but upstream seems the most ideal place for ease of use and effiency.

@vicanso
Copy link
Owner

vicanso commented Jan 2, 2025

The next version considers adding this configuration in location.

@vicanso vicanso added enhancement New feature or request and removed question Further information is requested labels Jan 2, 2025
@vicanso
Copy link
Owner

vicanso commented Jan 18, 2025

@NebulaMods You can add this to location config,

enable_reverse_proxy_headers = true

which will add these header to location's upstream proxy request:

  "X-Real-IP:$remote_addr".to_string(),
  "X-Forwarded-For:$proxy_add_x_forwarded_for".to_string(),
  "X-Forwarded-Proto:$scheme".to_string(),
  "X-Forwarded-Host:$host".to_string(),
  "X-Forwarded-Port:$server_port".to_string(),

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

No branches or pull requests

2 participants