1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

How to configure filter to rewrite characters in URL attributes in Wildfly 21 (Undertow 11)...

Discussão em 'StackOverflow' iniciado por Stack, Janeiro 8, 2021.

  1. Stack

    Stack Membro Participativo

    I have Wildlfy 21.0.2.Final installation that uses jboss:domain:undertow:11.0 under the hood.

    In standalone.xml in the Undertow subsystem I would like to set up URL rewriting to replace all | characters in the query parameters of any requests to %7C.

    Can this be achieved with filters like this?

    <subsystem xmlns="urn:jboss:domain:undertow:11.0" default-server="default-server" default-virtual-host="default-host" default-servlet-container="default" default-security-domain="other"">
    <buffer-cache name="default" />
    <server name="default-server">
    <http-listener name="default" socket-binding="http" allow-unescaped-characters-in-url="true" redirect-socket="https" enable-http2="true" />
    <https-listener name="https" socket-binding="https" max-post-size="1048576000" allow-unescaped-characters-in-url="true" security-realm="UndertowRealm" enabled-cipher-suites="TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA" enabled-protocols="TLSv1.2,TLSv1.3" enable-http2="true" />
    <host name="default-host" alias="localhost">
    <filter-ref name="rewriteFilter" predicate="regex('\|\|')" />
    <http-invoker security-realm="ApplicationRealm" />
    </host>
    </server>
    <servlet-container name="default">
    <jsp-config recompile-on-fail="true" />
    <websockets />
    </servlet-container>
    <filters>
    <expression-filter name="rewriteFilter" expression="regex('\|\|') -> rewrite('%7C%7C')" />
    </filters>
    ...
    </subsystem>


    What I want is that when I have this incoming:

    /rest/v3/news/_lite?mql=customerId=1212090,caseId=1078841||caseId=null


    to be replaced to this:

    /rest/v3/news/_lite?mql=customerId=1212090,caseId=1078841%7C%7CcaseId=null


    (Side note: As you can see, I do have allow-unescaped-characters-in-url="true" in both http-listener and https-listener, but they are not working for some reason and any GET requests I have with | (pipe) characters in query parameters won't even get processed.)

    Continue reading...

Compartilhe esta Página