Forum Discussion
Need assistance rewriting a hostname and appending a uri.
- 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" }
Thanks Kevin and James for the quick responses!
I ended up using what both of you recommended.
when HTTP_REQUEST
{ if { [HTTP::uri] equals "/" or [HTTP::uri] equals "/TREE.HTML" }
{ HTTP::respond 301 "Location" "https://lemons.com/fruit/TREE.html" }
else { HTTP::header replace Host "lemons.com"
pool lemons.com_pool } }
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