.htaccess proxy pass through

Discussion in 'General' started by EvoIX_MR2006, May 27, 2010.

  1. EvoIX_MR2006

    EvoIX_MR2006 New Member

    Hello,

    I am trying to use .htaccess to proxy a site through as a domain hosted on the litespeed server.

    This doesn't work:
    RewriteEngine on
    RewriteRule (.*) http://www.google.ca/$1 [P]

    But this does:
    RewriteEngine on
    RewriteRule (.*) http://www.google.ca/$1 [L]

    The latter redirects directly to google.ca. If I put an external App of type web server and set it to the google IP, and leave the .htaccess as the top example, it does a redirect instead of a reverse proxy.

    I beleive I asked about this a few months back, and was told the feature was being implemented? Can anyone confirm?

    Thanks.
  2. mistwang

    mistwang LiteSpeed Staff

    You need to create a web server external app with name "www.google.ca".
  3. NiteWave

    NiteWave Administrator

    your example of google looks not good: it looks like google can detect this and refuse to be reverse proxy'ed.
    Code:
    RewriteEngine on
    RewriteRule (.*) http://www.google.ca/$1 [P]
    assume the name of your external App of web server is google_backend, the rewrite rule should be
    Code:
    RewriteEngine on
    RewriteRule (.*) http://google_backend/$1 [P,QSA]
    this can archive success partly:
    for example, access http://yousite.com/abcd, it will access google.ca/abcd, and return a "404 Not Found" page from google.

    However if you use your own site instead of google, should be successful.

Share This Page