Forum Discussion

Algebraic_Mirror's avatar
Algebraic_Mirror
Icon for Cirrostratus rankCirrostratus
Nov 22, 2019
Solved

Can an LTM traffic policy include the user's querystring in a redirect action?

Does anyone know if an LTM traffic policy (version 13.1) can include the user's original querystring in any redirect that it does?

 

For example, my simple traffic policy has a rule that looks for this URI path: /testquery.html (there will be a dynamic, unpredictable query string also, but the match looks just at the URI path). Upon matching, the action it takes is a redirect to /testquery2.html. I want to include the same query string verbatim in the redirect destination.

 

I've attempted to put "?[HTTP::query]" at the end of my redirect, hoping that perhaps it would take an iRule command like that, but I received an error message. Is there any other way to include this, such as a pre-populated variable or something? I know some fields in other parts of the product can take dynamic variables, even if it isn't always obvious.

 

 

WHAT I AM LOOKING FOR IN AN ANSWER:

  • I am not looking for iRule solutions that might do the same thing, so I respectfully request that you please don't post one as an answer. I know this can be done with an iRule, but to make this easy to maintain for those that come after me (who may not understand iRules), I am trying to find out if an LTM traffic policy can do this in an out of the box way, and if so how.
  • If you can confirm that this is definitely not possible to do with the LTM traffic policy, that would be a good answer. But please make sure it's confirmed for certain, not just assumed.
  • If there is another out of the box way to do this that I'm missing, that would also be a good answer. But other modules like ASM, APM, etc, are not licensed or provisioned, so I can't use features specific to those modules. I only have LTM to work with.

 

  • Finally found some documentation that answers this question. It IS possible to use variables, etc, in an LTM Traffic Policy. It's called TCL Command Substitution. The specifics are discussed in this document.

    In this example, the following should go in the redirect field:

    tcl:/querytest2.html\?[HTTP::query]

    Having that "tcl:" at the beginning tells the traffic policy to treat what follows as a TCL string to be evaluated, and at that point you can use TCL commands, particularly those that involve simple reading from pre-created variables, such as this one for the HTTP query string.

1 Reply

  • Finally found some documentation that answers this question. It IS possible to use variables, etc, in an LTM Traffic Policy. It's called TCL Command Substitution. The specifics are discussed in this document.

    In this example, the following should go in the redirect field:

    tcl:/querytest2.html\?[HTTP::query]

    Having that "tcl:" at the beginning tells the traffic policy to treat what follows as a TCL string to be evaluated, and at that point you can use TCL commands, particularly those that involve simple reading from pre-created variables, such as this one for the HTTP query string.