Forum Discussion
Cindy_127211
Nimbostratus
Aug 16, 2006Rewriting Hostname & URI on HTTP_Request without a 'redirect'
I would like to 'rewrite' the following hostname/uri:
http://www.website1.com/index.php?cid=1234
to
http://www.website2.com/app1/index.php?cid=1234
without usin...
JRahm
Admin
Aug 16, 2006Sorry about that..I thought setting the host with that command was valid. Try this (I'm assuming you have a pool assigned in the vip?):
when HTTP_REQUEST {
if {[HTTP::uri] starts_with "/index.php"} {
log "Requested URL is [HTTP::host][HTTP::uri]"
HTTP::uri "/livestrongportfolios[HTTP::uri]"
HTTP::header replace "Host" "www.americancentury.com"
log "New URL is [HTTP::host][HTTP::uri]"
} else {
HTTP::redirect "https://[HTTP::host][HTTP::uri]"
}
}I'm still a little foggy on when these values are actually set, and I think it varies depending on the command, so if you are getting the same value with the second log statement in the HTTP_REQUEST event, try putting the second log statement in the HTTP_REQUEST_SEND event instead:
when HTTP_REQUEST_SEND {
log local0. "New URL is [HTTP::host][HTTP::uri]"
}Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
