Forum Discussion

3 Replies

  • Hi Bayuwindu,

    I guess you're talking about the "Location" header that is used for 301/302/307 HTTP redirects, isn't it?

    To change those values you could use an HTTP_RESPONSE iRule in combination with the [HTTP::header] and [string map] command to tweak the redirect to your internal server names.

    The required code would look like this...

     

    when HTTP_RESPONSE {
        if { [HTTP::header exist Location] } then {
            HTTP::header replace Location [string map { "http://web.test.com:2000" "https://web.test.com" } [HTTP::header value Location]]
        }
    }
    

     

    Cheers, Kai

  • Hi Kai, Thanks for your responses, but it didn't work. After doing inspect elements in my browser, I found that link response is given by javascript. Still searching for the solution.

     

  • Hi,

    before searching if the reverse proxy is able to rewrite responses, did you search if your application have a configuration solution to define reverse proxy URL?

    For example, tomcat support this configuration:

    you can also configure tomcat to inspect X-forwarded-proto header and insert this header in HTTP request with irule.

    Sharepoint support this with Alternate access mapping...

    IBM web sphere support this with following parameters:

     

    trusthostheaderport = true
    com.ibm.ws.webcontainer.extractHostHeaderPort = true
    httpsIndicatorHeader = X-Forwarded-Proto
    

     

    So first, look at the application documentation for reverse proxy options and add expected headers in requests to optimize F5 performances and limit rewrite issues.

    For one customer, when enabling response rewriting in irules, Appliance's performance was divided by 10... a simple configuration on the application server allowed me to disable rewriting without additional CPU load on backend server.

    rewriting must be used only if there is no other solution.