Forum Discussion
Creating A Redirect with Local Traffic Policies v11.4
This is not a question, I'm just putting this out here to help people who have run into this problem.
Before 11.4, you could easily redirect from HTTP to HTTPS using HTTP Classes. In 11.4, HTTP Classes are no longer present, and there is not yet a solution article published showing how to accomplish the same thing using Local Traffic Policies. You should be able to get by with this for now.
- First, you need to Create a policy with the matching strategy of your choice, I chose “best-match”. Chose a name for the policy.
- This policy should require “http”, and control “forwarding”.
- You can then add a rule. Choose a name for the rule
- For the rule conditions, leave the defaults in (empty conditions list).
- For the actions, the target should be “http-reply”, the event should be “request” and the action “redirect”. You will have the location parameter available to you. Set the value to :
. This is exactly the same as it is on the HTTP Class documentation (Ref: http://support.f5.com/kb/en-us/solutions/public/7000/100/sol7125.html?sr=32531961 )https://[getfield [HTTP::host] ":" 1][HTTP::uri]
- Click “Add” for the parameter, then “Add” again to add the action to the list of actions.
- Click Finished once done, and then you can attach this policy to the virtual server of choice, and it should redirect all requests to the HTTPS equivalent of the incoming host and URI combination.
17 Replies
- ictjl
Altocumulus
This helped us. Thanks! - ictjl
Altocumulus
I'm on version 11.5.3 and I still don't see the option to change the response to a 301 instead of 302 in the LTM policies. Does anyone have a solution for that yet? - rob_carr
Cirrocumulus
This construction appears to no longer work in v12.
- Stanislas_Piro2
Cumulonimbus
In version 12.0, tcl expression may be formatted like:
tcl:[tcl expr]
try :
tcl:[https://[getfield [HTTP::host] ":" 1][HTTP::uri]]
- JG
Cumulonimbus
Come to think of it, the whole point of using a policy for this is to remove the need of programming, i.e. having to have someone to write irules, apart from for better performance. Another benefit of that would be more robustness for automation.
Apparently there's still way to go to achieve that.
Don't get me wrong, though, for I love programming myself. :-)
- Jeya_Kirushna_2
Nimbostratus
Thanks :)
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