Forum Discussion
HTTP Response Rewrite
If the header is always the same you can simple do the following:
when HTTP_RESPONSE {
if {[HTTP::header exists "X-Storage-Url"]} {
HTTP::header replace "X-Storage-Url" "http://example.com/v1/AUTH_example"
}
}
This is quicker than trying to for a search and replace in the value of the header.
If the header is dynamic then the following would take the header and split it into a list using "/" as a split character, replace the first element in the list with "http:" then replace the header after joining the list.
when HTTP_RESPONSE {
if {[HTTP::header exists "X-Storage-Url"]} {
set xStorageUrl [split [HTTP::header "X-Storage-Url"] "/"]
lreplace $xStorageUrl 0 0 "http:"
HTTP::header replace "X-Storage-Url" [join $xStorageUrl "/"]
}
}
You can also do this with a regular expression however as much more resource intensive recommend this only if the volume is going to be low and you do not have a lot of iRules running on the F5.
when HTTP_RESPONSE {
if {[HTTP::header exists "X-Storage-Url"]} {
HTTP::header replace "X-Storage-Url" [regsub "^https" [HTTP::header "X-Storage-Url"] "http"]
}
}
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