Forum Discussion
Jim_Gore_43214
Nimbostratus
Oct 26, 2006Need to modify host name/port in node generated redirect
Hello,
I am attempting to move some web sites under the F5 v9.2.3 without modifing the site itself. There are redirects from the sites and absolute links in the generated pages.
I have created a stream profile for taking care of changing the absoltute URLs in the payload to point back to the virtual but have not been able to take care of the node generated redirects yet. These redirects would need to be pointing back to the same virtual server as well in this case.
b profile stream epbt2_stream_profile target
PROFILE epbt2_stream_profile - target string @http@https@@rb13@epbt2@@:8050@@
Is there an easy way to do this?
Thanks in advance!
Jim
- Jim_Gore_43214
Nimbostratus
Just messing around with the Location header, I was able to accomplish what i wanted to with the node submitted redirect:when HTTP_RESPONSE { if {[HTTP::is_redirect] } { log local0. "Request redirected." log local0. "[HTTP::header names]" log local0. "[HTTP::header Location]" set rURL [HTTP::header Location] regsub -all http $rURL https newURL regsub -all rb13 $newURL epbt2 newURL regsub -all :8050 $newURL "" newURL log local0. $newURL HTTP::header replace Location $newURL } }
- Colin_Walker_12Historic F5 AccountI think you can probably accomplish the same thing with a little simpler, and certainly more efficient code by making use of the string map command like this:
when HTTP_RESPONSE { if { [HTTP::is_redirect] } { log local0. "Request redirected." log local0. "[HTTP::header names]" log local0. "[HTTP::header Location]" set $newURL [string map -nocase {http https rb13 epbt2 :8050 ""} [HTTP::header Location] ] HTTP::header replace Location $newURL } }
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