Forum Discussion
ShakN_167332
Nimbostratus
Aug 20, 2014I want to Redirect multiple Sites in a single Irule. please help me with the irule command.
I have mulitple sites where i want my LAN users should not to redirected to https when they use url with http. but when any internet users use http://abc.com than it should redirect to https://abc.co...
nitass
Employee
Aug 20, 2014I have mulitple sites where i want my LAN users should not to redirected to https when they use url with http. but when any internet users use http://abc.com than it should redirect to https://abc.com
you may use IP::addr to check whether it is lan user traffic and then redirect if not.
e.g.
config
[root@ve11a:Standby:In Sync] config tmsh list ltm virtual bar
ltm virtual bar {
destination 172.28.24.10:80
ip-protocol tcp
mask 255.255.255.255
pool foo
profiles {
http { }
tcp { }
}
rules {
qux
}
source 0.0.0.0/0
source-address-translation {
type automap
}
vs-index 65
}
[root@ve11a:Standby:In Sync] config tmsh list ltm rule qux
ltm rule qux {
when HTTP_REQUEST {
if { !([IP::addr [IP::client_addr] equals 172.28.24.0/24]) } {
HTTP::redirect "https://[HTTP::host][HTTP::uri]"
}
}
}
test1 (client ip is 172.28.24.11)
[root@ve11a:Standby:In Sync] config curl -I http://172.28.24.10/
HTTP/1.1 200 OK
Date: Wed, 20 Aug 2014 07:08:10 GMT
Server: Apache/2.2.3 (CentOS)
Last-Modified: Sun, 09 Feb 2014 08:39:51 GMT
ETag: "41879c-59-2a9c23c0"
Accept-Ranges: bytes
Content-Length: 89
Content-Type: text/html; charset=UTF-8
test2 (client ip is 172.28.77.29)
curl -I http://172.28.24.10/
HTTP/1.0 302 Found
Location: https://172.28.24.10/
Server: BigIP
Connection: Keep-Alive
Content-Length: 0
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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