Forum Discussion
Baqar_Husain_81
Nimbostratus
Feb 05, 2008action if http::header host exists
Simple enough question, and I'm drawing a blank and can't find anything relevant in the wiki or the forums:
Just looking for the correct syntax ..
if exists Host then replace HTTP::host with my.xyz.com
else
insert HTTP::header Host your.xyz.com
I'm converting HTTP/1.0 requests to HTTP/1.1 ... that part is working fine, but I want the LTM to insert an HTTP HOST entry should the original 1.0 request not have it.
Thanks
- hoolio
Cirrostratus
Something like this?when HTTP_REQUEST { if {[string length [HTTP::header value Host]]}{ HTTP::header replace Host my.xyz.com } else { HTTP::header replace Host your.xyz.com } }
- Deb_Allen_18Historic F5 AccountWhy not just use the "HTTP::header exists" command?
when HTTP_REQUEST { if {[HTTP::header exists Host]}{ HTTP::header replace Host my.xyz.com } else { HTTP::header replace Host your.xyz.com } }
- Baqar_Husain_81
Nimbostratus
Thank you both. - Baqar_Husain_81
Nimbostratus
would the HTTP::header replace Host your.xyz.com work if the Host statement doesn't exist? - hoolio
Cirrostratus
The wiki page for HTTP::header (Click here) indicates that if the header doesn't exist already, it will be inserted, so Deb's example should work perfectly.
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