Forum Discussion

mjbeadle's avatar
mjbeadle
Icon for Nimbostratus rankNimbostratus
Aug 30, 2013

Redirect rewrite to remove explicit port

We have an app server that is behaving strangely and I need to try to fix it at the F5.

 

The server is sending back a 302 moved redirect with the location formatted like this:

 

https://rwqdn:80/uri

 

Since it is https, redirect rewrite in the http profile does not do anything with it.

 

Can I use an iRule similar to theses below:

 

https://devcentral.f5.com/articles/rewriting-redirects.UiC5Dn8srsU

 

https://devcentral.f5.com/wiki/irules.rewritehttpredirecthostname.ashx

 

For the purposes of the built in functions is the :80 part of the host name? Can this be accomplishes somewhere other than iRule?

 

Thanks for any input-

 

Mike

 

1 Reply

  • A few ways to do this, but here's one example:

    when HTTP_RESPONSE {
        if { [HTTP::is_redirect] } {
            HTTP::header replace Location [lindex [split [HTTP::header Location] ":"] 0]
        }
    }