Forum Discussion

Anesh's avatar
Anesh
Icon for Cirrostratus rankCirrostratus
Apr 26, 2017

SSL Forward proxy and 302 Redirects?

The below iRule is part of an SSL Intercept solution to sent traffic to Bluecoat Proxies after being decrypted, but certain sites send a 302 redirect with an https location header and i think this results in a redirection loop, does anyone have any experience with this kind scenario while deploying an SSL Forward proxy and what would be the fix, i tried capture the response and remove the location header and inserting an http one, but that did not work out..

when HTTP_REQUEST {
    if { $static::DEBUG } { log local0. "in event" }
     Check proxy service availability. If down, VIP target around it to egress
    if { [active_members $static::PROXY_SERVICE_POOL] == 0 } {
         Proxy service is down - VIP target around it to egress
        log local0. "ALERT: Proxy service is down - skipping to egress"
        virtual $static::EGRESS_TCP_VIP
    } else {
        if { $static::DEBUG } { log local0. "sending to proxy service" }
         Get the hostname from the X-Proxy-HTTPS header or the Host header
        if { [HTTP::header exists X-Proxy-HTTPS] } {
             use the SNI value
            set host [lindex [split [HTTP::header X-Proxy-HTTPS] ":"] 1]
            set port 80
        } else {
             use the Host header
            if { [HTTP::host] contains ":" } {
                set host [lindex [split [HTTP::host] ":"] 0]
                set port [lindex [split [HTTP::host] ":"] 1]
            } else {
                set host [HTTP::host]
                set port 80
            }
        }

         Send modified PROXY request
        HTTP::uri "http://${host}:${port}[HTTP::uri]"
        HTTP::header insert Proxy-Connection "Keep-Alive"

         Direct to the downstream proxy (and optionally enable SNAT)
        snat automap
        pool $static::PROXY_SERVICE_POOL
    }       
} 

2 Replies

  • Instate of

     HTTP::uri "http://${host}:${port}[HTTP::uri]"
    

    Try below line.

    HTTP::respond 302 Location "http://${host}:${port}[HTTP::uri]"