Need 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

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
  }
}

Is there a better way to do this?

Thanks!

Jim

I 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
  }
}

This should process each key/value pair in order for the string in question. You can read more about this command on sourceforge in TCL’s docs - Click here

HTH,

Colin