Forum Discussion
Vincent_Power_9
Nimbostratus
Jun 07, 2005Rewriting a header inside RESPONSE_DATA
I have an application that uses its local server name when it builds a redirect URL during the authentication phase.
Example it sends back now
location: http://server1.atl.bluecross.ca/funky-uri
What I want it to send back
location: https://www.atl.bluecross.ca/funky-uri
How could I rewrite this in the RESPONSE_DATA before it makes it back to the client. I would love any help you can give me.
- Vincent_Power_9
Nimbostratus
Basically I'm trying to move from an Apache Reverse Proxy to a BIG-IP, and need to know how to replace the functionality of ProxyPassReverse using iRules. - JRahm
Admin
I don't have a box to test this on, but here's a start for you.when HTTP_RESPONSE { set newhost "www.atl.bluecross.ca" if { [HTTP::header host] eq "server1.atl.bluecross.ca" } { HTTP::header replace host $newhost } }
- Vincent_Power_9
Nimbostratus
The problem I am having trouble over coming is that I am trying to find a way to basically do the equivalent of "s/http:\/\/server.:8080/https:\/\/bigtest1/" on the location header of the outgoing data. The Apache ProxyPassReverse function handled this for me, and now I need to find a way to duplicate this functionality. - Vincent_Power_9
Nimbostratus
I think I have it figured out, far this works the way I want.when HTTP_RESPONSE { set gmpHost "http://server1.atl.bluecross.ca:8080/" set ssoHost "http://server2.atl.bluecross.ca:8080/" set bigHost "https://bigtest1.atl.bluecross.ca/" set location [HTTP::header location] if { $location starts_with $gmpHost } { regsub -all $gmpHost $location $bigHost newLocation HTTP::header replace location $newLocation } elseif { [HTTP::header location] starts_with $ssoHost } { regsub -all $ssoHost $location $bigHost newLocation HTTP::header replace location $newLocation } }
- drteeth_127330Historic F5 AccountYou should be able to do this without an iRule. The redirect rewrite option on the HTTP profile should provide the Location header rewrite that you're looking for.
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