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...
Cindy_127211
Nimbostratus
Aug 16, 2006I have tried the fomrat that you suggested below, but it doesn't work. The rules editor shows a 'red' circle next to the HTTP::host statement and I am getting the following error in the 'ltm' log.
BTW, I've also tried to put [] brackets around the HTTP::host and HTTP::uri variables, as well as use the 'set' statement in front. None of these produces the changed host or uri names according to what is logged in the ltm log.
Aug 16 08:25:20 kc0501-bigip-03 mcpd[702]: 01070151:3: Rule [lvsredirect_w_cid_test] error: line 12: [wrong args] [HTTP::host "www.americancentury.com"]
Following is the 'exact' rule that I've been trying to get to work:
when HTTP_REQUEST {
if {[HTTP::uri] starts_with "/index.php"} {
Put uri into a variable
set uriValue [HTTP::uri]
Set constant string 1, 1st part
set strA "/livestrongportfolios/index.php?cid="
Get the cid uid
set ciduid [findstr $uriValue "cid=" "4" "&"]
log local0. "This is the ciduid variable: $ciduid"
Set the new url
set newuri [concat $strA$ciduid]
HTTP::host "www.americancentury.com"
HTTP::uri $newuri
log local0. "This is the newuir: $newuri"
log local0. "This is the new host: [HTTP::host]"
log local0. "This is the new uri: [HTTP::uri]"
}
else {
HTTP::redirect "https://[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
