Forum Discussion

Sonny's avatar
Sonny
Icon for Cirrus rankCirrus
May 21, 2008

http to https redirect EXCEPTION

I current have this iRule that forces http to https traffic.

 

 

when HTTP_REQUEST {

 

HTTP::redirect "https://XXX.DOMAIN.com/"

 

}

 

 

Question: What would be the best way to add an exception?

 

 

I.E. Say I want EXCLUDE this URL, "http://XXX.DOMAIN.com/utilities/".
  • Thanks for the reply! I think this simple rule will work, too. What do you guys think?

     

     

     

    when HTTP_REQUEST {

     

    if {[HTTP::uri] ends_with "utilities"}{

     

    pool pool_XXX

     

    }

     

    else

     

    HTTP::redirect "https://XXX.DOMAIN.com/"

     

    }
  • Forgot a close } at the end... So...

     

     

     

    when HTTP_REQUEST {

     

    if {[HTTP::uri] ends_with "utilities"}{

     

    pool pool_XXX

     

    }

     

    else

     

    HTTP::redirect "https://XXX.DOMAIN.com/"

     

    }

     

    }
  • Thanks aherrman! I think the "starts_with" would be better since I do want everything under it from being redirected bc the program already does so...

     

     

  • Glad I could help.

     

     

    Just want to make sure you noticed the "/" before "utilities" in my example. The URI will start with "/" since it's everything after the host.