Forum Discussion

AlexDeMarco's avatar
AlexDeMarco
Icon for Nimbostratus rankNimbostratus
Oct 07, 2013

Redirect question

Over the past year or so our redirect irule has grown and grown I am trying to stream line it a bit.

 

Here is a snippet of what I had: if { ( $req_uri starts_with "/amps") or ( $req_uri starts_with "/amps/") or ( $req_uri starts_with "/emergencycontact") or ( $req_uri starts_with "/emergencycontact/") or ( $req_uri starts_with "/counselor") or ( $req_uri starts_with "/counselor/*") } then { HTTP::redirect "https://[HTTP::host][HTTP::uri]" }

 

I want to be sure the www.myurl.com/amps and anything under amps gets redirected into SSL. Is there a better way to do this? I know I could make a datagroup (which I probably will do) but what about the code?

 

    thanks in advance..

                            - Alex

1 Reply

  • A Switch would clean it up a bit but I do like the idea of the data group so you can add more without changing the code. One other point is to not send HTTP::uri back unless you have scrubbed it. If the user clicks on a link with a script tag as a parameter to /amps, you will induce a reflected XSS issue. You can find other hints on scrubbing your uri (I was not sure if this is behind APM or not).

     

    If you want the whole site to be SSL, I like to do the redirect back to the landing page ( so leave off the uri). That might mess up someone's bookmarks but it's a small risk.

     

    Tom Schaefer