DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43319>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43319

           Summary: when combined with mod_proxy, mod_rewrite NE flag does
                    not work correctly
           Product: Apache httpd-2
           Version: 2.3-HEAD
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: mod_rewrite
        AssignedTo: [email protected]
        ReportedBy: [EMAIL PROTECTED]


I was trying to send %3d to backend server as a reverse proxy.
--[Conf
With rewrite rule
RewriteEngine on
RewriteLogLevel 3
RewriteRule ^(.*)test.txt$  http://agneyam.india.sun.com:2000/val\%3dtest.txt 
[NE,P]

]
>[
GET /http/me/test.txt HTTP/1.0

]

gets sent to back end as

>[
GET /val%253dtest.txt HTTP/1.1
Host: agneyam.india.sun.com:2000
Max-Forwards: 10
X-Forwarded-For: 129.158.224.203
X-Forwarded-Server: agneyam
Connection: Keep-Alive

]

ie, the % gets escaped again.
If I remove the [P] from the flags, the url generated is correct.
With out mod_proxy (N) in it,

RewriteRule ^(.*)test.txt$  http://agneyam.india.sun.com:2000/val\%3dtest.txt 
[NE]
>[
GET /http/me/test.txt HTTP/1.0
]
<[
HTTP/1.1 302 Found
Date: Thu, 06 Sep 2007 08:24:42 GMT
Server: Apache/2.3.0-dev (Unix)
Location: http://agneyam.india.sun.com:2000/val%3dtest.txt
Content-Length: 232
Location: http://agneyam.india.sun.com:2000/val%3dtest.txt
Content-Length: 232
Connection: close
Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>302 Found</title>
</head><body>
<h1>Found</h1>
<p>The document has moved <a href="http://agneyam.india.sun.com:2000/
val%3dtest.txt">here</a>.</p>
</body></html>
]
(notice that the %3d is not munged.)

Just for checking, I removed the NE flag too, which gave the expected result 
(which, with out the NE flag is to escape %)
>[
GET /http/me/test.txt HTTP/1.0
]
<[
HTTP/1.1 302 Found
Date: Thu, 06 Sep 2007 08:26:02 GMT
Server: Apache/2.3.0-dev (Unix)
Location: http://agneyam.india.sun.com:2000/val%253dtest.txt
Content-Length: 234
Location: http://agneyam.india.sun.com:2000/val%253dtest.txt
Content-Length: 234
Connection: close
Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>302 Found</title>
</head><body>
<h1>Found</h1>
<p>The document has moved <a href="http://agneyam.india.sun.com:2000/
val%253dtest.txt">here</a>.</p>
</body></html>
]



====================================================
Just to verify the behavior, I did further tests.
====================================================

If I remove the '\' from % in rewrite rule, (Just to see what happens.)
RewriteRule ^(.*)test.txt$  http://agneyam.india.sun.com:2000/val%3dtest.txt 
[NE,P]

>[
GET /http/me/test.txt HTTP/1.0
]

gets sent to back end as

>[
GET /valdtest.txt HTTP/1.1
Host: agneyam.india.sun.com:2000
Max-Forwards: 10
X-Forwarded-For: 129.158.224.203
X-Forwarded-Server: agneyam
Connection: Keep-Alive

]

Using Rewriterule with out NE flag,
RewriteRule ^(.*)test.txt$  http://agneyam.india.sun.com:2000/val\%3dtest.txt 
[P]

>[
GET /http/me/test.txt HTTP/1.0
]

gets sent to back end as

>[
GET /val%253dtest.txt HTTP/1.1
Host: agneyam.india.sun.com:2000
Max-Forwards: 10
X-Forwarded-For: 129.158.224.203
X-Forwarded-Server: agneyam
Connection: Keep-Alive

]
(ie: there is no change from using NE and not using it.)

Using mod_proxy directly using ProxyPass and not Rewrite does it the other way
(changes Hex to chars)
with ProxyPass
ProxyRequests On
ProxyVia On
ProxyPass /http http://agneyam.india.sun.com:2000
>[
GET /http/me/val%3dtest.txt HTTP/1.0
]

gets sent to back end as:
>[
GET /me/val=test.txt HTTP/1.1
Host: agneyam.india.sun.com:2000
Max-Forwards: 10
Via: 1.0 agneyam
X-Forwarded-For: 129.158.224.203
X-Forwarded-Server: agneyam
Connection: Keep-Alive

]

=====================
Summary
=====================
The NE flag does not have an effect when mod_proxy (P) is involved.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to