Forum Discussion

stupid48's avatar
stupid48
Icon for Altocumulus rankAltocumulus
Jun 15, 2015

Rewrite Response Header coming from pool members?

Hi there,

 

I'm running 11.6 LTM. I'm publishing Oracle iSupplier to the internet but my hostnames differ from inside to outside. I'm using an iApp (f5.http) to do this. I've set the iApp to use SSL offload since our internal server is not SSL. The issue I'm running into is that when I hit the login page, I'm getting sent to non-ssl with the internal hostname. I'm running F12 Developer Tools on my browser and see where the "Response header" "Location" is the one sending me there. On my old proxy server (Microsoft ISA), the pool node sends the same response but the ISA Proxy module is rewriting the location with https and the external host name.

 

Can someone assist me with creating a rule to do this?

 

Thanks alot, Chris

 

4 Replies

  • try this quick and dirty.. based on a search on Devcentral..

    when HTTP_RESPONSE {
      if { [HTTP::status] contains "302"} {
        if { [HTTP::header location] starts_with "http:///" } {
          log local0. "Location header matches : [HTTP::header location]"
          HTTP::header replace location "https:///[HTTP::uri]"
        }
      }
    }
    
  • Thanks for the info.

     

    I get this when I try to use this rule:

     

    error: [command is not valid in current event context (HTTP_RESPONSE)][HTTP::uri]

     

    I'll keep searching...

     

  • [HTTP::uri] is not available in HTTP_RESPONSE EVENT.

    the following irule correct the issue.

    when HTTP_REQUEST {
       set url [HTTP::uri]
    }
    when HTTP_RESPONSE {
      if { [HTTP::status] contains "302"} {
        if { [HTTP::header location] starts_with "http:///" } {
          log local0. "Location header matches : [HTTP::header location]"
          HTTP::header replace location "https:///$url"
        }
      }
    }
    
  • I found a different way but I appreciate the starting point. I'm really a beginner to the irules...

     

    when HTTP_RESPONSE { if { [HTTP::status] contains "302"} { if { [HTTP::header location] starts_with "" } { log local0. "Location header matches : [HTTP::header location]" HTTP::header replace location [string map {"" ""} [HTTP::header Location]] } } }