Layer7 API Management

Expand all | Collapse all

Is it possible to use a Cluster-wide property as regex for a Regular Expression Assertion?

Jump to Best Answer
  • 1.  Is it possible to use a Cluster-wide property as regex for a Regular Expression Assertion?

    Posted 10-24-2017 09:42 AM

    Hi all,

     

    We have regex expressions that are environment-specific. Since we're using GMU for migration between environments, we want this expressions to be defined as cluster-wide properties so they can be templatized.

     

    Is it possible to use a Cluster-wide property as regex for a Regular Expression Assertion? The policy manager doesn't show any errors but the replacement it's not working so far.

     

    Thanks in advance,

    -Jaime



  • 2.  Re: Is it possible to use a Cluster-wide property as regex for a Regular Expression Assertion?

    Posted 10-30-2017 07:25 PM
      |   view attached

    Jaime,

     

    Just tried to use cluster wide properties in the regular expression assertion on a version 9.2 gateway and it worked. I have attached a sample policy that used 2 cluster wide properties foo=1234 and reg=foo.

     

    Sample output:

    <test>1234</test>

    Sincerely,

     

    Stephen Hughes

    Director, CA Support

    Attachment(s)



  • 3.  Re: Is it possible to use a Cluster-wide property as regex for a Regular Expression Assertion?

    Posted 11-15-2017 02:23 PM

    Unfortunately, if you add any regular expression values in the reg property, this doesn't work. Trying reg=foo.* or reg=.* or reg=^.*$ for example.  I believe this behavior is described in the documentation: Evaluate Regular Expression Assertion - CA API Gateway - 9.2 - CA Technologies Documentation  See the "Example: Context variables in the regular expression" section.

     

    This prevents us from using properties for these expressions in our different environments.



  • 4.  Re: Is it possible to use a Cluster-wide property as regex for a Regular Expression Assertion?
    Best Answer

    Posted 11-16-2017 12:43 PM

    You correct after reviewing this further and testing in our lab that the context variable will be taken literally. The only other way would be to build extra logic that has the values static in the policy and branch based on a cluster wide property for the environment.

     

    The best suggestion would be to open an idea up on our community so our product management team and review.

     

    Stephen Hughes

    Director, CA Support