Proxying without URL encoding

Discussion in 'General' started by Marcus, Jan 8, 2009.

  1. Marcus

    Marcus New Member

    Hi,

    Is there any way to proxy a request without URL-encoding '&' and '='? I'm having problems with some backends because of it.

    Thanks.
  2. Marcus

    Marcus New Member

    I think the problem I have is that the URL is being re-written with URL-encoded characters, but using the 'NE' flags seems to be having no effect (they're still being encoded).
    Last edited: Jan 8, 2009
  3. mistwang

    mistwang LiteSpeed Staff

    can you give an example rewrite rule?
  4. Marcus

    Marcus New Member

    I have the following situation:

    - a web server defined in the config with the name 'besvr', which is open on port 8000
    - the following rewrite rule:

    RewriteRule ^/admin(.*)$ http://besvr/admin$1 [NE,L,P]

    With the aim of proxying anything beginning with /admin to the backend.

    The following url:

    /admin&lang=fr

    should be passed directly as it is, should it not (because the NE flag should mean the & and = are not encoded), however it is passed as;

    /admin%26lang%3Den

    which breaks it on the backend and produces an error page.

    If I go directly to (besvr):8000/admin&lang=fr

    the page is displayed as expected.

    I've tried this in 3.3.23 and 4.0b3 and the result is the same.

    It appears to me that the NE flag is not doing its job, or otherwise I've misunderstood what it does.
  5. Marcus

    Marcus New Member

    In the logs, there are these entries

    Code:
    2009-01-08 04:44:39.556 [INFO] [127.0.0.1:36632-0#simpl-ssl] [REWRITE] Rule: Match '/admin&lang=en' with pattern '^/admin(.*)$', result: 2
    2009-01-08 04:44:39.556 [INFO] [127.0.0.1:36632-0#simpl-ssl] [REWRITE] Source URI: '/admin&lang=en' => Result URI: 'http://besvr/admin&lang=en'
    2009-01-08 04:44:39.556 [INFO] [127.0.0.1:36632-0#simpl-ssl] [REWRITE] Last Rule, stop!
    
    Not indicating any URL encoding, but sending it back to LSWS itself (to test), I get the following entry in the access log:

    Code:
    ["besvr"] 127.0.0.1 - - [08/Jan/2009:04:44:39 +0000] "GET /admin%26lang%3Den HTTP/1.1" 404 2288 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.5) Gecko/2008121621 Ubuntu/8.04 (hardy) Firefox/3.0.5"
    
  6. mistwang

    mistwang LiteSpeed Staff

    Please download and try latest 4.0b3 package, should be fixed.
  7. Marcus

    Marcus New Member

    Yes, it works as expected now.

    Thanks for fixing it so quickly.

Share This Page