Forum Discussion
williehood_2622
Aug 23, 2018Nimbostratus
irule redirect pool uri http or https
I'm writing irule, I have two pools one for hhtps traffic and one for http traffic. I would like to have irule that based on uri "ex ; goes to http on pool1 any other port 80 redirects to https pool ...
jaikumar_f5
Aug 23, 2018MVP
Think your requirement is quite below,
- http traffic with /content - Allow to unsecure_80
- http traffic without /content - Not Allow to unsecure_80 redirect to secure
- https traffic with /content - Allow to secure
- https traffic without /content - Not Allow to secure redirect to unsecure_80
Apply the below rule_http to 80VS
ltm rule rule_http {
when HTTP_REQUEST {
switch [string tolower [HTTP::uri]] {
“/content” { pool unsecure_80 }
"default" { HTTP::redirect "https://[HTTP::host][HTTP::uri]" }
}
}
}
Apply the below rule_https to 443VS
ltm rule rule_https {
when HTTP_REQUEST {
switch [string tolower [HTTP::uri]] {
“/content” { HTTP::redirect "http://[HTTP::host][HTTP::uri]" }
"default" { pool secure }
}
}
}
I'm sure there are lot of ways this can be achieved with single VIP Irule logic too. But this is clean and simple according to me.
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects