LTM Policy http-reply issue

Hi,

We are trying to migrate to v12 and we are facing a problem about the SOL14996 that is working fine in v11.6: Even setting the host part as static, we can’t see the [HTTP::uri] being replaced.

create ltm policy test_policy rules add { https_reply { actions add { 0 { http-reply redirect location https://mysite.net[HTTP::uri] } } } } strategy first-match  requires add { http } controls add { forwarding }
BIG-IP response:
HTTP/1.0 302 Found
Location: https://mysite.net[HTTP::uri]
Server: BigIP
Connection: close
Content-Length: 0

This is a SOL14996 example that fails in v12 (v11.6 is ok):

create /ltm policy myHTTPtoHTTPSpolicy controls add { forwarding } requires add { http } strategy first-match rules add { myHTTPtoHTTPSrule { actions add { 0 { http-reply redirect location "https://[getfield [HTTP::host] \":\" 1][HTTP::uri]" } } } }
01071748:3: Policy '/Common/myHTTPtoHTTPSpolicy', rule 'myHTTPtoHTTPSrule'; invalid url, value 'https://[getfield [HTTP::host] ":" 1][HTTP::uri]'.

So, I really don’t want to rewrite this in iRule, but for now I can’t see another way.

Is it a BUG or needs some trick?

Thank you!

Hi,

Sorry about that, I solved this problem as follows:

http-reply request redirect location"tcl:[concat https://[getfield [HTTP::host] \":\" 1][HTTP::uri]]"

So obvious! :slightly_smiling_face:

Thank you so much!

There is currently a new solution article published (SOL26312346) with the appropriate syntax for v12.x, including the use of tcl: before using any tcl variables (e.g. HTTP::uri). This only applies to the GUI input to create the LTM policy.

I was not aware that there is another option to do a redirection, next to the build in iRule “_sys_https_redirect”. We are using this iRule since 11.5 (and also on our 12.1.1 testing machines).

So here’s my question: Why not using this iRule? Are there any downsides in iRules compared to a policy solution? I mean, the code is basically the same, but adding an iRule takes less clicks. (Don’t get me wrong, my question is meant seriously).

I was not aware that there is another option to do a redirection, next to the build in iRule “_sys_https_redirect”. We are using this iRule since 11.5 (and also on our 12.1.1 testing machines).

So here’s my question: Why not using this iRule? Are there any downsides in iRules compared to a policy solution? I mean, the code is basically the same, but adding an iRule takes less clicks. (Don’t get me wrong, my question is meant seriously).

Hi Ichnafi,

using LTM Policy or iRules is most likely just a personal preference. From a technical standpoint are LTM Policies a little faster during execution, but on the other site more limited than iRules.

Cheers, Kai