How do I create a reverse proxy like Apache?

Discussion in 'Apache Migration/Compatibility' started by lotusone, Apr 17, 2009.

  1. lotusone

    lotusone Member

    Hi, on a shared server, I need to serve all requests to a URL ( through another local server. In Apache, I put:

    <VirtualHost *:80>
    DocumentRoot /path/to/files/
    ProxyPass /
    ProxyPassReverse /

    How do I implement this in litespeed? I'm on a shared host that uses Apache configs, so I can't go through litespeed's "Virtual Host" admin. I see the "Web Server" type of "External App," but seems to be no way to call it for a specific path.

    Sean DeNigris
  2. mistwang

    mistwang LiteSpeed Staff

    You need to have your shared server admin to create a "Web Server" external application with name " : port" exactly match the address used in ProxyPass at server level, then comment out "ProxyPass", "ProxyPassReverse", add rewrite rule instead

    RewriteRule /(.*)$1 [p] 
  3. lotusone

    lotusone Member

    Thanks! Does that rewrite do the function of both the ProxyPass and the ProxyPassReverse?
  4. mistwang

    mistwang LiteSpeed Staff

    Unfortunately, LiteSpeed does not rewrite URL in the response body.
    It may not required as the backend server still see the original request with original host name, not .
  5. lotusone

    lotusone Member

    Ok, I'll give it a shot. Thanks :)
  6. lotusone

    lotusone Member

    I tried:
    but it didn't rewrite the URL at all

    After some experimentation, I made the app listen externally (for testing purposes only) and found that:
    Redirected to the app.

    However, I want an internal rewrite, not an external redirect, so I changed to "[p]," but I got a 500 Internal server error. It was not the app itself because I could see that it never received any http requests and there was nothing in the webserver's error log.

    What do you think?
  7. mistwang

    mistwang LiteSpeed Staff

    RewriteRule (.*)$1 [p]
    should work.
    You have to remove the leading '/' if you use the rewrite rule in .htaccess.

Share This Page