Forum Discussion
Exclude a Specfic url from https re-direction from _sys_https_redirect F5 supplied rule
Hi,
I am new F5 LTM world and have just begun playing with iRules ; In my F5 lab i am using the F5 supplied Rule to redirect all http traffic to https as follows:
when HTTP_REQUEST {
{ [HTTP::redirect] https://[getfield [HTTP::host] ":" 1][HTTP::uri] }
}
What i want to achieve is serve a url from both the HTTP VS and HTTPS VS without having to removing the "_sys_https_redirect" rule from the HTTP VS. So if go request only http://abc.com i should be served from HTTP VS and not re-direct to HTTP VS i tired to add a "NOT " operator to skip HTTPS re-direction when HTTP::host matches a test url as follows:
when HTTP_REQUEST {
if {[HTTP::host] not "abc.com" } { pool abc.com_pool }
else { [HTTP::redirect] https://[HTTP::host] [HTTP::uri] }
}
However this does not works. I also tried to add a seprate iRule for abc.com placed above the _sys_https_redirect which also did not work , is there any better/simplified way to achieve this??
2 Replies
- Vijay_E
Cirrus
when HTTP_REQUEST { if { ([HTTP::host] eq "abc.com") } { pool abc.com_pool } else { HTTP::redirect https://[HTTP::host][HTTP::uri] } }iRule will be applied on VS:80
The above logic will send http://abc.com/* to abc.com_pool
Everything else: http:/// will be redirected to the HTTPS version
Is this what you are seeking ? If not, provide the logic that you want to execute via iRule.
I think Odaah has the logic backwards. You want requests for abc.com to Not be redirected, correct? If so, then you don't need the "ne" or not statements. Just do a equals or a ends_with, depending on how accurate you want to match the value of HTTP::host.
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