You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Jeff DeFord <je...@gmail.com> on 2006/09/26 18:09:30 UTC

[users@httpd] proxy and rewrite question - need help!

All:

I have some questions regarding the best approach to implementing
Apache as a reverse proxy using mod_rewrite in order to mask the real
URLs. Users will connect to the proxy, then the proxy will connect to
the real server that is listening on port 8050 (SSL)

So far this is what I have working:

Proxy server listining on port 80 and on 443 and I am
using a rewrite rule to force a rediect to 443 only as shown below:

  ## Redirect all incoming HTTP requests to HTTPS locally before proxying.
  RewriteRule ^/(.*) https://proxy.server.com/$1 [R,L]

This works just as expected as my initial http connection gets forced to https.

Then I have the following proxy statements set up as shown below for
the default SSL virtual host on the proxy server:

  ProxyRequests     Off
  SSLProxyEngine    On
  SSLProxyCACertificateFile conf/cacerts.crt
  ProxyPreserveHost On
  ProxyPass         / https://real.server.com:8050/
  ProxyPassReverse  / https://real.server.com:8050/

This all works great for all of the URLs on the root level. The home
page URLs on the real server get rewritten and they appear to have
originated from the proxy server when I connect and I mouse over or
click on a root-level URL.

However, any URL with a subdirectory below the root level on the real
server does not get rewritten and the real URL (complete URL icluding
port number 8050) is visible on the proxied web page.

Now, how do go I about getting this to work for all of the URLs with
subdirectories?

Do I need rewrite rules for each URL that has a subdirectly below the
root with a subsequent ProxyPass and ProxyPassReverse statement?

Do my rewrite rules need to use the proxy flag [P]? Or will they work
once written to mimic the root-level rules?

Many thanks in advance for any help that you may provide....

-=jeff

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org