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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃殌 Trusted Reverse Proxy and get c.Hostname() value from X-Forwarded-Host and etc #1300

Closed
4n70w4 opened this issue Apr 25, 2021 · 2 comments 路 Fixed by #1397
Closed

馃殌 Trusted Reverse Proxy and get c.Hostname() value from X-Forwarded-Host and etc #1300

4n70w4 opened this issue Apr 25, 2021 · 2 comments 路 Fixed by #1397
Assignees

Comments

@4n70w4
Copy link

4n70w4 commented Apr 25, 2021

Is your feature request related to a problem?

Hi!

I tried to find something similar for gofiber on github and google, but the search did not return any results.

I use reverse proxies like nginx and Traefik. It's uses headers X-Forwarded-Host, X-Forwarded-Proto and X-Forwarded-For for pass hostname, protocol and real client ip of original request.

And Trusted Proxies whitelist for describe ip's of reverse proxies on requests from which it is allowed to take values from these headers.

https://symfony.com/doc/3.2/components/http_foundation/trusting_proxies.html
https://github.com/fideloper/TrustedProxy

Examples:

If request ip in Trusted Proxies whitelist then:

  • c.Protocol() get value from X-Forwarded-Proto header
  • c.IP() get value from X-Forwarded-For header
  • c.Hostname() get value from X-Forwarded-Host header

But if request ip NOT in Trusted Proxies whitelist then:

  • c.Protocol() DON'T get value from X-Forwarded-Proto header
  • c.IP() DON'T get value from X-Forwarded-For header
  • c.Hostname() DON'T get value from X-Forwarded-Host header

Describe the solution you'd like

Describe alternatives you've considered

Additional context

@welcome
Copy link

welcome bot commented Apr 25, 2021

Thanks for opening your first issue here! 馃帀 Be sure to follow the issue template! If you need help or want to chat with us, join us on Discord https://gofiber.io/discord

@4n70w4 4n70w4 changed the title 馃殌 Get c.Hostname() value from X-Forwarded-Host and etc 馃殌 Trusted Reverse Proxy and get c.Hostname() value from X-Forwarded-Host and etc Apr 26, 2021
@oroshnivskyy
Copy link
Contributor

Hi! May I work on this issue?

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

Successfully merging a pull request may close this issue.

3 participants