Proxying without URL encoding

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

  1. Marcus

    Marcus Well-Known Member


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

  2. Marcus

    Marcus Well-Known 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 Well-Known 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:


    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;


    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 Well-Known Member

    In the logs, there are these entries

    2009-01-08 04:44:39.556 [INFO] [] [REWRITE] Rule: Match '/admin&lang=en' with pattern '^/admin(.*)$', result: 2
    2009-01-08 04:44:39.556 [INFO] [] [REWRITE] Source URI: '/admin&lang=en' => Result URI: 'http://besvr/admin&lang=en'
    2009-01-08 04:44:39.556 [INFO] [] [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:

    ["besvr"] - - [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: 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 Well-Known Member

    Yes, it works as expected now.

    Thanks for fixing it so quickly.

Share This Page