Forum Discussion
Kirit_Patel_521
Nimbostratus
Jun 01, 2010https redirect
Does anyone know how to do redirect to https in f5 using irule . On ace I do it this way
rserver redirect turn-redirect
webhost-redirection
https://%h%p
inservice
serverfarm redirect 218.7.139.10-redirect
description
arch-notest.turn.com
predictor leastconns
rserver
turn-redirect
inservice
3 Replies
- Michael_Yates
Nimbostratus
This will do an HTTP to HTTPS Redirect on any Virtual Server it is applied to:when HTTP_REQUEST { HTTP::redirect https://[getfield [HTTP::host] ":" 1][HTTP::uri] } - Kirit_Patel_521
Nimbostratus
mike
thanks what does the "1" do in [HTTP::host] ":" 1] - hoolio
Cirrostratus
The command is a way to strip out a port in the host header field, if one is present.
getfield parses the HTTP host header value, splits it on a : if one is there and returns the first field. See the wiki page for details:
http://devcentral.f5.com/wiki/default.aspx/iRules/getfield
So if you have a host header of www.example.com:80 or www.example.com, that getfield command will return www.example.com in both cases.
Aaron
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