Forum Discussion
Want to insert X-Forwarded-for Original Hostname.
One of our virtual server has an irule to rewrite the original incoming URL to a custom URL toward the server.
How can I include the original hostname as a X-Forwarded-For header so that that can be used as well by the application server.
Our iRule:
when HTTP_REQUEST {
if {[HTTP::host] equals "original.hostname.com" } {
Replace host header value original.hostname.com with custom.hostname.com
HTTP::header replace Host custom.hostname.com
}
}
We would want to insert a X-forwarded-For [original hostname]
Thanks,
2 Replies
- JG
Cumulonimbus
That option of passing the "X-forwarded-For" header is in an HTTP profile you can create and attach to your virtual server.
- IheartF5_45022
Nacreous
Personally I would not use X-Forwarded-For as it's now a de-facto RFC-header which is used to store an IP address. Here is what you need (chose your own header name);-
when HTTP_REQUEST { if {[HTTP::host] equals "original.hostname.com" } { Replace host header value original.hostname.com with custom.hostname.com HTTP::header insert X-Forwarded-Host [HTTP::header Host] HTTP::header replace Host custom.hostname.com } }
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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