KJ_50941
Sep 28, 2012Nimbostratus
iRule hlep
I need to redirect from http to https , also since some users have bookmark specific port for exmaple port 8050 in their browser to be redirect to https. how do I do that.
does this works...
[root@ve10:Active] config b virtual wildcard list
virtual wildcard {
destination 172.28.19.79:any
ip protocol 6
rules myrule
profiles {
http {}
tcp {}
}
}
[root@ve10:Active] config b rule myrule list
rule myrule {
when HTTP_REQUEST {
log local0. "\[HTTP::host\] = [HTTP::host]"
log local0. "\[getfield [HTTP::host] : 1\] = [getfield [HTTP::host] : 1]"
log local0. "\[HTTP::uri\] = [HTTP::uri]"
HTTP::redirect https://[getfield [HTTP::host] : 1][HTTP::uri]
}
}
[root@ve10:Active] config b virtual bar list
virtual bar {
snat automap
pool foo
destination 172.28.19.79:443
ip protocol 6
profiles {
clientssl {
clientside
}
tcp {}
}
}
on client
curl -I http://172.28.19.79:8050/something -H "Host: www.somedomain.com:8050"
HTTP/1.0 302 Found
Location: https://www.somedomain.com/something
Server: BigIP
Connection: Keep-Alive
Content-Length: 0
on F5
[root@ve10:Active] config tail -f /var/log/ltm
Sep 30 20:53:10 local/tmm info tmm[4925]: Rule myrule : [HTTP::host] = www.somedomain.com:8050
Sep 30 20:53:10 local/tmm info tmm[4925]: Rule myrule : [getfield www.somedomain.com:8050 : 1] = www.somedomain.com
Sep 30 20:53:10 local/tmm info tmm[4925]: Rule myrule : [HTTP::uri] = /something