Problem with lshttp and Apache Reverse Proxy

Discussion in 'Install/Configuration' started by hofred929, May 19, 2008.

  1. hofred929

    hofred929 Member

    I have configured litespeed 3.3.11 with php4 4.4.8 (recompiled) on an internal Linux RHEL4-U2 box and the Horde/IMP mail application worked fine.
    However, when I try to access the domain via the external IP address serviced by the Apache with Reverse Proxy, I got error 404:
    404 Not Found
    The resource requested could not be found on this server!

    Note that in the test I have shutdown the internal Apache webserver on port 80 and activated LiteSpeed on port 80.

    Looking at the Virtual host domain log, the only message was:
    202.64.220.xx - - [19/May/2008:00:12:48 +0800] "GET / HTTP/1.1" 404 390 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20080201 Firefox/"

    The lsws VHOST configuration is:
    <?xml version="1.0" encoding="UTF-8"?>
    <suffixes>jpeg, png, jpg, gif</suffixes>

    The external Apache (outside the Firewall) configure is:
    <VirtualHost 202.64.220.xx:80>
    LogLevel warn
    ErrorLog logs/error.log
    TransferLog logs/access.log
    <IfModule mod_proxy.c>
    ProxyPass /
    ProxyPassReverse /

    There're no errors on the external Apache log in reviewing any problem on the proxy.

    Note also that I am not enable Apache config in the lsws setup.

    Any ideas what I did wrong in the setup for Reverse Proxy?
  2. mistwang

    mistwang LiteSpeed Staff

  3. hofred929

    hofred929 Member

    Hi, the listener is set to *:80 for all IP addresses on the machine already. I have other VHOSTs defined on this machine as well, all on port 80 but using different IP addresses.

    I can access the web sites okay within the 192.168.1 network. The only problem is through the external IPs proxy, it failed with 404 errors. The trouble is I couldn't find any error messages on Apache nor LSWS telling me exactly what's wrong. Stopping LSWS and restarted Apache on the host the web sites can be access with no problem via the proxy.

    Attached is the httpd_config.xml.

    Please help.

    Attached Files:

  4. mistwang

    mistwang LiteSpeed Staff

    add "" to the "domain" section of the vhost associated with that IP.
  5. hofred929

    hofred929 Member

    So the <domain> part is actually an IP address, it won't do a DNS lookup?
  6. hofred929

    hofred929 Member

    Thanks. By changing the domain name to IP address it fixed the problem and Apache reverse proxy worked. But then, the URL showed instead of as in Apache.
    Is there anyway to use the domain name in the URL instead of the internal IP which will failed outside the firewall?

    Apache has the UseCanonicalName setting which will set the IP address to the ServerName as specified in the httpd.conf. How can LSWS miminc this?

    PS. I have an internal DNS which will resolve the domain to the internal IP address if inside the internal network, and to the external IP when outside the Firewall through the ISP's DNS.

  7. mistwang

    mistwang LiteSpeed Staff

    You can use both

  8. hofred929

    hofred929 Member

    It worked the URL page showed domain name
    But the PHP application Horde/IMP makes use of the PHP _SERVER[] array settings and I found that LSWS did not set the variable _SERVER['SERVER_NAME'] to the domain name but the IP address instead. The Horde PHP application will redirect the URL using the PHP system variable _SERVER['SERVER_NAME'] and rendered the web page failure.

    I am including the phpinfo() output on "PHP Variables" from the Apache (4311phpinfo.html) and from the LSWS (448phpinfo.html) for your information. Is there anyway to set the SERVER_NAME to in LSWS?


    Attached Files:

  9. mistwang

    mistwang LiteSpeed Staff

    Try "ProxyPreserveHost" directive if you use Apache 2.x
  10. hofred929

    hofred929 Member

    That fix it. Many Thanks.

    As a side question, does LSWS support Reverse Proxy? If so, how do I configure it?
  11. mistwang

    mistwang LiteSpeed Staff

Share This Page