Forum Discussion
URI Based HTTP/HTTPs redirection.
Hello folks,
Can you please help me building an iRule with a specific requirement? The scenario is, a specific URI should not get redirect over HTTPs and rest of the traffic shall redirect to HTTPs.
For eg. http://mydomain.com/first/second/third - Should never go to HTTPs.
However when user tries to open http://mydomain.com, it should always redirect to https://mydomain.com/first/second I hope you understand the exact requirement.
Thanks folks! Darshan
3 Replies
- nathe
Cirrocumulus
How about modifying the default https redirect irule:
When HTTP_REQUEST { if { not ([HTTP::uri] eq "/first/second/third") } { https://[getfield [HTTP::host] ":" 1][HTTP::uri] } }How does that look?
N
- swo0sh_gt_13163
Altostratus
Hey Nathan,
Thanks for your help mate. I will give it a go and let you know. I am still newbie to F5. I didn't get meaning of 3rd line of the iRule. i.e.
https://[getfield [HTTP::host] ":" 1][HTTP::uri]
Could you please help me understand what does it mean how it will process the request?
Thanks again, Darshan
- nathe
Cirrocumulus
Simply it's redirecting but it's also accounting for, and removing, any non standard http port (if one is being used of course e.g. 8080).
Hope this helps.
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