Forum Discussion
Adrian_Turcu_10
Nimbostratus
Oct 30, 2007Help With HTTP_RESPONSE
Hello Gurus
Could someone help me with a quick rule to replace a header in the response back to the client, please?
My problem is like follows: we have a poxi app (not proxy) and t...
Adrian_Turcu_10
Nimbostratus
Oct 30, 2007That Location header will be in this form (I got a header sniff on the replies)
Location: http://127.0.0.1/nexthop.jsp
If I put
HTTP::redirect http://$shost$clocation
where clocation is gotten from
set clocation [HTTP::header "Location"]
would that not result in a final (?):
http://$shosthttp://127.0.0.1/nexthop.jsp
I'd say something like this would do the trick:
when HTTP_REQUEST {
set shost [getfield [HTTP::host] ":" 1]
set smethod [HTTP::HTTP::method]
}
when HTTP_RESPONSE {
if { [HTTP::status] starts_with "3" } {
set rlocation [HTTP::header "Location"]
set rurl [split $rlocation /]
set ruri /[join [lrange $rurl 3 end] /]
HTTP::header replace Location $smethod://$shost$ruri
}
}
Would you agree? Not sure if my TCL is right to extract the actual string from the location header....
Thanks,
Adrian
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