Forum Discussion
Rewriting Location Header in iRule
Hello everyone,
I'm trying to find a way to manipulate the HTTP::header location.
For each redirection containing a location header from the backend server, I need to rewrite just the host part of the URL following this rule:
If the location contains "http://webserver01:8282", the iRule should rewrite the host to "https://externallink.com" while preserving the rest of the URL.
For example:
http://webserver01:8282/login should be rewritten to https://externallink.com/login.
Any help to achieve this would be greatly appreciated.
Thanks!
Hi Hamza,
when HTTP_RESPONSE { if { [HTTP::header Location] starts_with "http://webserver01:8282"} { HTTP::header replace Location [string map {"http://webserver01:8282" "https://externallink.com"} [HTTP::header Location]] } }
- Hamza_derbaliAltostratus
Thanks.
Hi Hamza,
when HTTP_RESPONSE { if { [HTTP::header Location] starts_with "http://webserver01:8282"} { HTTP::header replace Location [string map {"http://webserver01:8282" "https://externallink.com"} [HTTP::header Location]] } }
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