Forum Discussion
change host header
I have two share point VS on my LTM one a legacy one which is more internal to the network and one with a wildcard for external access as well. Recently a migration took place on the sharepoint and now i need to redirect my old requests to the new URL. I am seing a 302 redirect from the server as well.
I wanted to write an IRULE to change all the host headers to get response from the new servers.
How should the rule be made ? Any ideas?
- souravkayal_287Nimbostratus
when HTTP_RESPONSE { if {[HTTP::status] == "302" } { HTTP::header replace Location [string map {"url1" "url2"} [HTTP::header Location]] } }
Will this work ? I need it for absolute URI
- BigD_300005Cirrostratus
Check out LTM Policies in the GUI over an iRule. They process faster and it is easier for people who do not know how to write iRules.
https://devcentral.f5.com/articles/what-is-http-part-ix-policies-and-irules-29141
- souravkayal_287Nimbostratus
I think Irule makes it more simpler ?
If old VS is no longer available after migration, you should redirect with HTTP request. If you need to change URI, replace old with new.
Code
When HTTP_REQUEST { 301 (Permanent Redirect) HTTP::respond 301 Location https://[HTTP::host][HTTP::uri] }
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