Forum Discussion
mnb_63148
Feb 10, 2014Nimbostratus
Need assistance rewriting a hostname and appending a uri.
I am having trouble rewriting a hostname and appending a url.
Below is a sample of what I am trying to do:
The user is going to https://apples.com. I need to send the user to https://lemons...
- Feb 10, 2014
Your HTTP_RESPONSE is incorrect and unnecessary, it's trying to replace the HTTP header called lemons.com with lemons.com if a Host header existed in the response, or killing the TCP connection with a RST and causing a blank page if the Host header didn't exist in the response. Have a look in /var/log/ltm for TCL Errors to determine what's happening.
Case insensitive:
when HTTP_REQUEST { switch [string tolower [HTTP::uri]] { "/" - "/tree.html" { HTTP::uri "/fruit/TREE.html" } } HTTP::header replace Host "lemons.com" }
Case sensitive:
when HTTP_REQUEST { switch [HTTP::uri] { "/" - "/TREE.HTML" { HTTP::uri "/fruit/TREE.html" } } HTTP::header replace Host "lemons.com" }
Kevin_Stewart
Feb 10, 2014Employee
Try this:
when HTTP_REQUEST {
catch blank URI
if { not ( [string tolower [HTTP::uri]] starts_with "/fruit" ) } {
HTTP::redirect "http://[HTTP::host]/fruit/TREE.html"
}
replace Host header
HTTP::header replace Host "lemons.com"
}
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