Forum Discussion
Emad
Cirrostratus
Feb 02, 2015Update Location Header in case of 302
Hi, What will be the best option to update Location URI in response if 302 redirect is present.
Purpose is not to update Host but to remove specific string from uri.
e.g
Actual: www.carrerslocation.com/contact
Rewrite In request to server from /contact/ to /myapp/index.php?contactus
Response Update Loaction to : www.carrerslocation.com/contact/index.php?contactus
1 Reply
- Michael_Jenkins
Cirrostratus
Something like this may help, if you have specific hhost(s) you're looking at. Otherwise, you could use the URI command to parse the location header and do some more specific replacements.
when HTTP_RESPONSE { if { [HTTP::is_redirect] } { switch -glob -- [string tolower [HTTP::header value location]] { "*www.carrerslocation.com/contact"} { HTTP::header replace location [string map -nocase {/contact /contact/index.php?contactus} [HTTP::header value Location]" } } }
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