I have an Apache server running on my machine (port 80)
I have a Zope server running on my machine (port 8080)
i want all users, irrespective of domain (lets use www.example.com for now) to be pushed to the zope instance, seamlessly
IE
if i type into my browser
http://www.example.com/mysite
it will display the effects of
http://www.example.com:8080/mysite
BUT
i want the URL to still say
http://www.example.com/mysite
(sub-)domain should be irrespective, as will have 2 or 3 domains pointing to the same server
am i supposed to be looking at mod_rewrite or mod_proxy?
I have the mod_rewrite half working,l but it changes what is in the browser?
currently trying
RewriteEngine on
RewriteRule ^($|/.*) http://localhost:8080/$1 [P]
but getting server 500
Connecting using "http://localhost/mysite"
Zope supports your scenario out-of-the-box with some special rewriting, using a VirtualHostMonster
flags in the path. This ensures that any URLs generated by Zope (and by extension, Plone) are correct for proxied requests as well.
You should use both mod_rewrite
and mod_proxy
, they'll be working in concert.
To make creating the right rewrite URLs easier, someone built an excellent RewriteRule Witch. Plugging in your specific example outputs:
RewriteRule ^/mysite($|/.*) \
http://127.0.0.1:8080/VirtualHostBase/\
http/%{SERVER_NAME}:80/mysite/VirtualHostRoot/_vh_mysite$1 [L,P]
Thus, for any URLs rooted at http://www.example.com/mysite
, rewrite these to be served from the server running on localhost port 8080, making sure that Zope generates URLs with the same root.
See the detailed documentation on the VirtualHostMonster feature on the Zope wiki for more details.
You can use either mod_rewrite
with a P
(proxy) rule or mod_proxy
to do what you want. Using mod_rewrite
your configuration would look something like this:
RewriteRule ^/mysite/(.*) http://www.example.com:8080/mysite/$1 [P]
Using mod_proxy
, your config would look like this:
<Location /mysite/>
ProxyPass http://www.example.com:8080/
ProxyPassReverse http://www.example.com:8080/
</Location>
Both accomplish approximately the same thing. Using a Location
block with ProxyPass
makes it easy to apply other configuration directives to this path on the front-end server.