Forum Discussion
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..
- Alex1 Reply
- Thomas_Schaefer
Nimbostratus
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
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com