Forum Discussion

Dmanden_23459's avatar
Dmanden_23459
Icon for Nimbostratus rankNimbostratus
Oct 28, 2011

Exclusion from Irule

Hey Guys

 

 

Hoping someone might be able to help me.

 

 

Ive been batteling with this iRule ofr a while now and I just cant seem to get it right.

 

 

I have a few virtual folders within a site that I need to redirect to HTTPS, I also need to exclude a specific folder beneath one of the VF's and then send it to a different location

 

 

some thing like below

 

 

www.google.com ( not the real site of course ) main site

 

www.google.com/test/* needs to be redirected to HTTPS

 

www.googel.com/test/unsecure/* needs to be excluded from the redirect sent to a seperate pool.

 

 

This is what ive come up with at the moment. Im not sure how close I am or not though

 

 

 

-----------------------------------------

 

 

when HTTP_REQUEST {

 

if { [string tolower [HTTP::uri]] starts_with "/test/unsecure" }

 

pool POOL-A }

 

if { ( [string tolower [HTTP::uri]] contains "/test/" and != "/test/unsecure" )

 

HTTP::redirect "https://[HTTP::host][HTTP::uri]" }

 

else { pool POOL-default

 

}

 

}

 

 

------------------------------------------

 

 

If anybody could take a look and perhaps advise where I am going wrong it would be much appreciated

 

 

Regards

 

 

Dennis

1 Reply

  • can you try this?

    when HTTP_REQUEST {
       switch -glob [string tolower [HTTP::uri]] {
          "/test/unsecure/*" { pool POOL-A } 
          "/test/*" { HTTP::redirect "https://[HTTP::host][HTTP::uri]" }
          default { pool POOL-default }
       } 
    }