Forum Discussion
Ayush07
Jul 05, 2019Altostratus
How to enable X-Forwarded-Host ?
X-Forwarded-For XFF i am aware that we enable it in custom http profile to insert client IP but looking to enable X-Forwarded-Host XFH as well, kindly please advise. Thank you
Try with this iRule ->
https://devcentral.f5.com/s/articles/http-forwarded-header-injection-1083
KR,
Dario.
- JurajCirrus
The following is part of my baseline HTTP iRule:
when HTTP_REQUEST { # Remove untrusted HTTP X-Forwarded headers # from HTTP requests and set our own: # # - X-Forwarded-For # - X-Forwarded-Host # - X-Forwarded-Port # - X-Forwarded-Proto # - X-Real-IP # # X-Forwarded headers clean-up # HTTP::header remove X-Forwarded-For HTTP::header remove X-Forwarded-Host HTTP::header remove X-Forwarded-Port HTTP::header remove X-Forwarded-Proto HTTP::header remove X-Real-IP # Set our own X-Forwarded and X-Real-IP headers # X-FORWARDED-FOR and X-REAL-IP # HTTP::header insert X-Forwarded-For [IP::client_addr] HTTP::header insert X-Real-IP [IP::client_addr] # X-FORWARDED-HOST # if { [HTTP::host] ne "" } { HTTP::header insert X-Forwarded-Host [HTTP::host] } else { HTTP::header insert X-Forwarded-Host [clientside {IP::local_addr}] } # X-FORWARDED-PORT # HTTP::header insert X-Forwarded-Port [TCP::local_port] # X-FORWARDED-PROTO # if { [PROFILE::exists clientssl] == 1 } { HTTP::header insert X-Forwarded-Proto "https" } else { HTTP::header insert X-Forwarded-Proto "http" } }
- Ayush07Altostratus
Thanks a lot Dario & Juraj....!!!
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects