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...
kjc
Nimbostratus
Feb 11, 2008This works... on the server that sends the last redirect to the original URL. Not intiutive, though, is it?
when HTTP_RESPONSE {
check if response is a redirect (HTTP status of 3xx)
if { [HTTP::status] starts_with "3" } {
Save original Location value
set location_original [HTTP::header value Location]
Check if the port the request was made on was 443
if { [HTTP::header value Location] contains ":443" } {
Request was made to an SSL port, replace http:// with https:// in the Location header value
set location_updated [string map "http:// https:// " $location_original]
Perform the actual header replacement
HTTP::header replace Location $location_updated
log local4. "Updated Location header value for HTTP request: $location_updated"
}
}
}
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