[undertow-dev] Disable URL decoding when rewriting

Lukas Lentner kontakt at lukaslentner.de
Mon Dec 11 13:32:16 EST 2017


Hi Stuart,

I am totally sure that my Path-Params get decoded twice and only if I use the rewrite feature. I make the same request to <SERVER>.../id=%252524
Once via the rewrite, once without the rewrite. My application sends me back the ID it received through JAX-RS PathParam and sends me back:
%2524 without and
%24 with rewrite

It is a simple JAX-RS Application without any decoding logic and only one rest endpoint. I am not even sure where the one decoding happens that I want to have (should be Resteasy, when it is providing the parameters to the resource method). But either way, if and only if I use the undertow rewrite I get %24 which is incorrect ...

Please have a look into this...

I have the possibility to remote debug the undertow when this happens. If there is any data I can provide to you that helps you track the error I am more than willing to do so ...

Bye
Lukas


----

Lukas Lentner, B. Sc.
 
St.-Cajetan-Straße 13
81669 München
Deutschland
 
Fon:     +49 / 89  / 44 38 61 27
Mobile:  +49 / 176 / 24 77 09 22
 
E-Mail:  Kontakt at LukasLentner.de
Website: www.LukasLentner.de

IBAN:    DE33 7019 0000 0001 1810 17
BIC:     GENODEF1M01 (Münchner Bank)


> -----Ursprüngliche Nachricht-----
> Von: Stuart Douglas [mailto:sdouglas at redhat.com]
> Gesendet: Montag, 11. Dezember 2017 01:54
> An: Lukas Lentner <kontakt at lukaslentner.de>
> Cc: undertow-dev at lists.jboss.org
> Betreff: Re: Disable URL decoding when rewriting
> 
> Rewrite should not affect the encoding, except for query parameters
> referenced through
> io.undertow.server.HttpServerExchange#getQueryParameters() which are
> always decoded.
> 
> Are you sure this is related to the rewrite? In general Undertow will decode
> all URI's to UTF-8 by default. If you want your app to handle all the encoding
> yourself you can set io.undertow.UndertowOptions#DECODE_URL to false,
> which will prevent Undertow from doing any decoding.
> 
> This does have some drawbacks though, mostly that it is a global setting that
> affects all applications.
> 
> Stuart
> 
> On Fri, Dec 8, 2017 at 6:48 PM, Lukas Lentner <kontakt at lukaslentner.de>
> wrote:
> > Hi,
> >
> >
> >
> > I am using Wildfly 10.1.0.final which means undertow 1.4.0.final and I
> > have the following problem. I configured my app with
> >
> >
> >
> > WEB-INF/undertow-handlers.conf :
> >
> > path-prefix('/application') -> rewrite('${remaining}')
> >
> >
> >
> > This works pretty well, but when the rewrite is triggered it seems to
> > once decode my URL. This is bad as my app will do the decoding at a
> > central place once and thus the url will be decoded twice if the
> > endpoint is called via /application/…
> >
> >
> >
> > How can I circumvent that undertow decodes my url before rewriting?
> >
> >
> >
> > Thankx
> >
> > Lukas
> >
> >
> >
> >
> >
> > ----
> >
> >
> >
> > Lukas Lentner, B. Sc.
> >
> >
> >
> > St.-Cajetan-Straße 13
> >
> > 81669 München
> >
> > Deutschland
> >
> >
> >
> > Fon:     +49 / 89  / 44 38 61 27
> >
> > Mobile:  +49 / 176 / 24 77 09 22
> >
> >
> >
> > E-Mail:  Kontakt at LukasLentner.de
> >
> > Website: www.LukasLentner.de
> >
> >
> >
> > IBAN:    DE33 7019 0000 0001 1810 17
> >
> > BIC:     GENODEF1M01 (Münchner Bank)
> >
> >



More information about the undertow-dev mailing list