httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sai A <>
Subject [users@httpd] mass proxying via mod_rewrite
Date Mon, 08 Nov 2010 17:44:54 GMT
Hi Apache users/experts,

I am trying to achieve proxying using mod_rewrite. I am trying to do the
following mappings:
Let remain as such
Let all special remain as such
Proxy to
Proxy to and are externally accessible on the
internet and for anyone accessing them using those URLs should still work
(backward compatible). This is the httpd.conf file that I have written.

1) Is this approach right? Would the following also achieve the
functionality achieved by ProxyPassReverse of mod_proxy?

# LoadModule directives for mod_rewrite, mod_proxy and mod_proxy_http

RewriteEngine on
UseCanonicalName off

RewriteMap    lowercase    int:tolower
RewriteMap    clients      txt:/path/to/

# If it is the main company site, then no looking up required.
RewriteCond %{HTTP_HOST}   ^(www)?\.company\.com [NC]
RewriteRule ^/(.*)$1 [L]

# Don't map any of the special company subdomains
RewriteCond %{HTTP_HOST}   ^special\.company\.com [NC]
RewriteRule ^/(.*)$1 [L]
# Do the above for other subdomains that should not be touched

# Rules for mapping client admin sites of the form
# to

RewriteCond   %{HTTP_HOST}    !^$
RewriteCond   %{REQUEST_URI}  ^/admin/.*
RewriteCond   ${lowercase:%{HTTP_HOST}}  ^(.+)$
RewriteCond   ${clients:%1}  ^(.+)$
RewriteRule   ^/admin/(.*)$$1 [P,L]

# Rules for mapping client sites of the form
# to

RewriteCond   %{HTTP_HOST}  !^$
RewriteCond   ${lowercase:%{HTTP_HOST}}  ^(.+)$
RewriteCond   ${clients:%1}  ^(.+)$
RewriteRule   ^/(.*)$$1 [P,L]

# Rules so that older client URLs work
This is an auxiliary question: 2) How can I do this?

My file is as follows: client1name client2name
# ... clientNname

Please let me know if this approach would work... if there are some caveats,
I'd like to know them as well.

Thanks in advance,

View raw message