You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Sylvain Thénault <sy...@logilab.fr> on 2008/01/29 16:31:18 UTC

[users@httpd] url containing %2F / mod_rewrite

Hi there!

I know this topic has already been discussed in the past since I've just
digged more than 2 hours in various archive without finding any solution
to this problem. I'm using apache as a proxy to another web server,
using mod_rewrite/mod_proxy. I need urls like :

  http://test.fr/%2Fhome

to be transfered to the underlying server with undecoded %2F. I've added

  AllowEncodedSlashes On

to my config, but mod_rewrite keep seing the %2F decoded, eg /home, and
I can't find any way to get the raw uri (without any encoding/decoding
processed) and give it as input to my rewrite rules. I know that %2F may
cause security issues, but that's not the point here, I only want apache
to act as a good software doing what I'm asking it to do ;) Any hint on
how can I acheive this ?

Thanks in advance
-- 
Sylvain Thénault                               LOGILAB, Paris (France)
Formations Python, Zope, Plone, Debian:  http://www.logilab.fr/formations
Développement logiciel sur mesure:       http://www.logilab.fr/services
Python et calcul scientifique:           http://www.logilab.fr/science


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] url containing %2F / mod_rewrite

Posted by Sylvain Thénault <sy...@logilab.fr>.
On Tue, Jan 29, 2008 at 04:37:38PM +0100, Chirouze Olivier wrote:
> Hi,
> 
> What exactly do you mean by "keeps seeing"? Did you try to play with the URI (logs, RewriteCond, etc) to make absolutely sure that it's the INPUT URI that is decoded, or could it be the "output" URI (the rewriten one) that is decoded?

yep, I really mean the input uri is decoded

-- 
Sylvain Thénault                               LOGILAB, Paris (France)
Formations Python, Zope, Plone, Debian:  http://www.logilab.fr/formations
Développement logiciel sur mesure:       http://www.logilab.fr/services
Python et calcul scientifique:           http://www.logilab.fr/science


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


RE: [users@httpd] url containing %2F / mod_rewrite

Posted by Chirouze Olivier <ol...@volvo.com>.
Hi,

What exactly do you mean by "keeps seeing"? Did you try to play with the URI (logs, RewriteCond, etc) to make absolutely sure that it's the INPUT URI that is decoded, or could it be the "output" URI (the rewriten one) that is decoded?

Olivier

> -----Original Message-----
> From: syt@logilab.fr [mailto:syt@logilab.fr] On Behalf Of 
> Sylvain Thénault
> Sent: 29 January 2008 16:31
> To: users@httpd.apache.org
> Subject: [users@httpd] url containing %2F / mod_rewrite
> 
> Hi there!
> 
> I know this topic has already been discussed in the past 
> since I've just
> digged more than 2 hours in various archive without finding 
> any solution
> to this problem. I'm using apache as a proxy to another web server,
> using mod_rewrite/mod_proxy. I need urls like :
> 
>   http://test.fr/%2Fhome
> 
> to be transfered to the underlying server with undecoded %2F. 
> I've added
> 
>   AllowEncodedSlashes On
> 
> to my config, but mod_rewrite keep seing the %2F decoded, eg 
> /home, and
> I can't find any way to get the raw uri (without any encoding/decoding
> processed) and give it as input to my rewrite rules. I know 
> that %2F may
> cause security issues, but that's not the point here, I only 
> want apache
> to act as a good software doing what I'm asking it to do ;) 
> Any hint on
> how can I acheive this ?
> 
> Thanks in advance
> -- 
> Sylvain Thénault                               LOGILAB, Paris (France)
> Formations Python, Zope, Plone, Debian:  
> http://www.logilab.fr/formations
> Développement logiciel sur mesure:       
> http://www.logilab.fr/services
> Python et calcul scientifique:           http://www.logilab.fr/science
> 
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP 
> Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] url containing %2F / mod_rewrite

Posted by Sylvain Thénault <sy...@logilab.fr>.
On Tue, Jan 29, 2008 at 05:10:06PM +0100, Sylvain Thénault wrote:
> On Tue, Jan 29, 2008 at 05:07:18PM +0100, Sylvain Thénault wrote:
> > On Tue, Jan 29, 2008 at 03:39:22PM +0000, Nick Kew wrote:
> > > On Tue, 29 Jan 2008 16:31:18 +0100
> > > Sylvain Thénault <sy...@logilab.fr> wrote:
> > > 
> > > >  Any hint on how can I acheive this ?
> > > 
> > > Upgrade to 2.2.8 and read the CHANGES file.  Then you'll
> > > know what to look for in the docs (either -B or nocanon,
> > > depending on how you're configuring it).
> > 
> > Also I can't find any mention of "-B" in the CHANGES file and this is
> > not an easy word to google for... Would you have more info about this?
> 
> ok I've found it, I guess you're talking about the B option of rewrite
> rules :)

so... I've been playing with the B flag of RewriteRule without much more
success. I've now the inverse problem : all unescaped special
characters such as / always get encoded, eg if I access to

  myserver/path/something

the underlying server is seeing

  /path%2Fsomething

gaaargl.. Maybe I misunderstand what can be acheived with url
encoding/decoding. I thought that for instance %2F was allowing me to
have url such as

  myserver/path/sub%2Fpath/subsubpath

which would be interpreted as an uri path containing 3 parts, "path",
"sub/path" (with a slash in the middle which shouldn't be used as
separator) and "subsubpath". Is that correct?

-- 
Sylvain Thénault                               LOGILAB, Paris (France)
Formations Python, Zope, Plone, Debian:  http://www.logilab.fr/formations
Développement logiciel sur mesure:       http://www.logilab.fr/services
Python et calcul scientifique:           http://www.logilab.fr/science


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] url containing %2F / mod_rewrite

Posted by Sylvain Thénault <sy...@logilab.fr>.
On Tue, Jan 29, 2008 at 05:07:18PM +0100, Sylvain Thénault wrote:
> On Tue, Jan 29, 2008 at 03:39:22PM +0000, Nick Kew wrote:
> > On Tue, 29 Jan 2008 16:31:18 +0100
> > Sylvain Thénault <sy...@logilab.fr> wrote:
> > 
> > >  Any hint on how can I acheive this ?
> > 
> > Upgrade to 2.2.8 and read the CHANGES file.  Then you'll
> > know what to look for in the docs (either -B or nocanon,
> > depending on how you're configuring it).
> 
> Also I can't find any mention of "-B" in the CHANGES file and this is
> not an easy word to google for... Would you have more info about this?

ok I've found it, I guess you're talking about the B option of rewrite
rules :)
-- 
Sylvain Thénault                               LOGILAB, Paris (France)
Formations Python, Zope, Plone, Debian:  http://www.logilab.fr/formations
Développement logiciel sur mesure:       http://www.logilab.fr/services
Python et calcul scientifique:           http://www.logilab.fr/science


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] url containing %2F / mod_rewrite

Posted by Sylvain Thénault <sy...@logilab.fr>.
On Tue, Jan 29, 2008 at 03:39:22PM +0000, Nick Kew wrote:
> On Tue, 29 Jan 2008 16:31:18 +0100
> Sylvain Thénault <sy...@logilab.fr> wrote:
> 
> >  Any hint on how can I acheive this ?
> 
> Upgrade to 2.2.8 and read the CHANGES file.  Then you'll
> know what to look for in the docs (either -B or nocanon,
> depending on how you're configuring it).

huum, that sounds interesting. I've tried to replace my (dumb) rewrite
rule with a simple ProxyPass directive using nocanon, and now the %2F is
correctly transfered, but I get a strange side effect: duplication of
form parameters encoded in the url : if I access myserver/path?key=val,
the underlying server is seeing path?vid=index?vid=index...

Also I can't find any mention of "-B" in the CHANGES file and this is
not an easy word to google for... Would you have more info about this?

Anyway thanks for your quick answer!

-- 
Sylvain Thénault                               LOGILAB, Paris (France)
Formations Python, Zope, Plone, Debian:  http://www.logilab.fr/formations
Développement logiciel sur mesure:       http://www.logilab.fr/services
Python et calcul scientifique:           http://www.logilab.fr/science


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] url containing %2F / mod_rewrite

Posted by Nick Kew <ni...@webthing.com>.
On Tue, 29 Jan 2008 16:31:18 +0100
Sylvain Thénault <sy...@logilab.fr> wrote:

>  Any hint on how can I acheive this ?

Upgrade to 2.2.8 and read the CHANGES file.  Then you'll
know what to look for in the docs (either -B or nocanon,
depending on how you're configuring it).

-- 
Nick Kew

Application Development with Apache - the Apache Modules Book
http://www.apachetutor.org/

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org