Forum Discussion

Teffany_142554's avatar
Teffany_142554
Icon for Nimbostratus rankNimbostratus
Aug 24, 2016

irule uri preservation for direct https requests

I need to preserve 3 uri but redirect all other requests. I created the following rule, which works on the http vip, but breaks the site if also applied to the https vip. What adjustment(s) am I missing?

 

when HTTP_REQUEST { if { ([HTTP::uri] equals "/a/b/c.asp") or ([HTTP::uri] equals "/d/e/f.txt") or ([HTTP::uri] equals "/x/y/z/") } { HTTP::redirect "https://[HTTP::host][HTTP::uri]"

 

} else { HTTP::redirect "https://www.mywebsite/apply" } }

 

2 Replies

  • Hamish's avatar
    Hamish
    Icon for Cirrocumulus rankCirrocumulus

    Infinite loop on the HTTPS request when accessing https://site.domain/a/b/c.asp and https://site.domain/x/y/z/ I'd guess

     

    Don't redirect back to yourself would be the recommendation from me... Do you really think you ned it on the https VS?

     

    H

     

  • Hi,

    If you apply this irule on HTTPS VS, it will loop for the three first URLs...

    when HTTP_REQUEST { 
        if { ([HTTP::uri] equals "/a/b/c.asp") or ([HTTP::uri] equals "/d/e/f.txt") or ([HTTP::uri] equals "/x/y/z/") } { 
            if {[TCP::local_port] equals 443} { 
                return
            } else {
                HTTP::redirect "https://[HTTP::host][HTTP::uri]"
            }
        } else { HTTP::redirect "https://www.mywebsite/apply" } 
    }