Forum Discussion
Redirect HTTP to HTTPS and path using iRules not working
- Dec 29, 2014
I'm able to configure the iRule to redirect the path from https://www.abc.com to https://www.abc.com/pageX.php. However I'm still having problem to redirect from HTTP request to HTTPS.
isn't it to just change http to https in HTTP::redirect command?
e.g.
configuration root@(ve11a)(cfg-sync Sync Failed)(Active)(/Common)(tmos) list ltm virtual bar ltm virtual bar { destination 172.28.24.10:80 ip-protocol tcp mask 255.255.255.255 profiles { http { } tcp { } } rules { qux } source 0.0.0.0/0 vs-index 13 } root@(ve11a)(cfg-sync Sync Failed)(Active)(/Common)(tmos) list ltm rule qux ltm rule qux { when HTTP_REQUEST { if { [HTTP::path] eq "/" } { HTTP::redirect "https://[HTTP::host]/pageX.php" } } } test [root@ve11a:Active:In Sync] config curl -I http://www.abc.com HTTP/1.0 302 Found Location: https://www.abc.com/pageX.php Server: BigIP Connection: Keep-Alive Content-Length: 0
I'm able to configure the iRule to redirect the path from https://www.abc.com to https://www.abc.com/pageX.php. However I'm still having problem to redirect from HTTP request to HTTPS.
isn't it to just change http to https in HTTP::redirect command?
e.g.
configuration
root@(ve11a)(cfg-sync Sync Failed)(Active)(/Common)(tmos) list ltm virtual bar
ltm virtual bar {
destination 172.28.24.10:80
ip-protocol tcp
mask 255.255.255.255
profiles {
http { }
tcp { }
}
rules {
qux
}
source 0.0.0.0/0
vs-index 13
}
root@(ve11a)(cfg-sync Sync Failed)(Active)(/Common)(tmos) list ltm rule qux
ltm rule qux {
when HTTP_REQUEST {
if { [HTTP::path] eq "/" } {
HTTP::redirect "https://[HTTP::host]/pageX.php"
}
}
}
test
[root@ve11a:Active:In Sync] config curl -I http://www.abc.com
HTTP/1.0 302 Found
Location: https://www.abc.com/pageX.php
Server: BigIP
Connection: Keep-Alive
Content-Length: 0
- Azlan_181023Dec 31, 2014
Nimbostratus
I realized that I need to create another virtual server for http service and apply this rule. It works now. Many thanks!!! And Happy New Year...
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
