How to configure to use a ${xxx} predicate variable (like ${1} or ${remaining}) in the undertow expression filter with CLI and in standalone.xml configuration file

Solution Verified - Updated -

Issue

  • How do I configure to use a ${xxx} predicate variable in the undertow expression filter with CLI or standalone(-*).xml configuration file? For example, I would like to use ${remaining} or ${1} like the following predicate:

    path-prefix('/foo') -> redirect('/foo-extra${remaining}')
    

    or

    regex(pattern="/user/(.*?)./.*", value=%U, full-match=true) and equals(%u, ${1})
    
  • Adding an undertow expression filter with a value ${xxx} returns an error in CLI:

    /subsystem=undertow/configuration=filter/expression-filter=foo:add(expression="path-prefix('/foo') -> redirect('/foo-extra${remaining}')")
    {
        "outcome" => "failed",
        "failure-description" => "WFLYCTL0211: Cannot resolve expression 'XXXXX'",
        "rolled-back" => true
    }
    

    I tried escaping ${remaining} with \ (like \${remaining}) in CLI:

    /subsystem=undertow/configuration=filter/expression-filter=foo:add(expression="path-prefix('/foo') -> redirect('/foo-extra\${remaining}')")
    

    However, the above ${remaining} is expanded as a system property variable. So, it does not work as expected.

  • Undertow predicates use the ${xxx} tag to access a value from the predicate context, but the expression is not valid for CLI or inside the standalone.xml or domain.xml file.

Environment

  • JBoss Enterprise Application Platform (EAP)
    • 7
  • Undertow / EAP filters (using value expressions to access the context)

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content