Forum Discussion
adiezma_1656
Nov 09, 2011Nimbostratus
iRule redirect http to https except! ...
Hi everyone!
I need a iRule can always redirect a URL from HTTP to HTTPS, except if the url ends in sync.php
Example in my internet browser:
http...
nitass
Nov 10, 2011Employee
e.g.
[root@ve1023:Active] config b virtual bar list
virtual bar {
snat automap
pool foo
destination 172.28.65.152:http
ip protocol tcp
rules myrule
profiles {
http {}
tcp {}
}
}
[root@ve1023:Active] config b rule myrule list
rule myrule {
when HTTP_REQUEST {
if {not ([string tolower [HTTP::path]] ends_with "sync.php")}{
HTTP::redirect "https://[HTTP::host][HTTP::uri]"
}
}
}
[root@ve1023:Active] config b virtual bar2 list
virtual bar2 {
snat automap
pool foo
destination 172.28.65.152:https
ip protocol tcp
rules myrule2
profiles {
clientssl {
clientside
}
http {}
tcp {}
}
}
[root@ve1023:Active] config b rule myrule2 list
rule myrule2 {
when HTTP_REQUEST {
if {[string tolower [HTTP::path]] ends_with "sync.php"}{
HTTP::redirect "http://[HTTP::host][HTTP::uri]"
}
}
}
[root@ve1023:Active] config curl -I http://blablabla.bla.com/
HTTP/1.0 302 Found
Location: https://blablabla.bla.com/
Server: BigIP
Connection: Keep-Alive
Content-Length: 0
[root@ve1023:Active] config curl -I http://blablabla.bla.com/test
HTTP/1.0 302 Found
Location: https://blablabla.bla.com/test
Server: BigIP
Connection: Keep-Alive
Content-Length: 0
[root@ve1023:Active] config curl -I http://blablabla.bla.com/sync.php
HTTP/1.1 404 Not Found
Date: Thu, 10 Nov 2011 01:10:46 GMT
Server: Apache/2.2.3 (CentOS)
Connection: close
Content-Type: text/html; charset=iso-8859-1
[root@ve1023:Active] config curl -Ik https://blablabla.bla.com/sync.php
HTTP/1.0 302 Found
Location: http://blablabla.bla.com/sync.php
Server: BigIP
Connection: Keep-Alive
Content-Length: 0
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