You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Mark Phillips <ma...@phillipsmarketing.biz> on 2006/09/06 20:26:03 UTC

[users@httpd] URL Rewriting Question

I have a domain (call it test.com for the purpose of this question - it is not 
the real domain) parked with a domain name registrar.
They provide free domain name forwarding. 

I have a server behind our firewall running apache 2.0 and zope/plone with a 
plone site (call it plone-site for this question). The server with plone-site 
and apache running behind our firewall has an internal address of 
192.168.20.130. Zope listens on port 8080, apache
listens on port 8081.

The domain registrar forwards test.com to our firewall, which is
58.45.32.9:8081 (again, this is not the actual IP address - I just made
this one up for this question).

Our firewall forwards the request on port 8081 to the apache server
listening on port 8081.

The apache server forwards the request to the zope/plone server on port 8080
(same physical machine).

When I type www.test.com in a browser address bar, I get the plone-site as 
expected. However, the address bar displays 58.45.32.9:8081/plone-site and 
not www.test.com. I had hoped that with url rewriting and apache I could get 
www.test.com in the address bar.

My rewrite rule is:
# rewrite any other access to the zope server using a proxy [P] and add the
VMH magic keywords
# use %{SERVER_NAME} instead of test.com to avoid busting the ServerAlias
# %{HTTP_HOST} is bad because it may contain the port
RewriteRule ^/(.*) \  
http://192.168.20.130:8080/VirtualHostBase/http/%{SERVER_NAME}:8081/plone-site/VirtualHostRoot/$1
[L,P]

which I took from an article describing a similar setup 
(http://plone.org/documentation/tutorial/plone-apache).

How can I get www.test.com to appear in the browser address bar when I access 
the site?

I realize this is a plone question as well, but I was hoping a url-rewrite 
expert might know off the bat what I am doing wrong. Thanks for any help you 
can provide!

Mark

---------------------------------------------------------------------
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


Re: [users@httpd] URL Rewriting Question

Posted by Joshua Slive <jo...@slive.ca>.
On 9/6/06, Mark Phillips <ma...@phillipsmarketing.biz> wrote:
> I have a domain (call it test.com for the purpose of this question - it is not
> the real domain) parked with a domain name registrar.
> They provide free domain name forwarding.
>
> I have a server behind our firewall running apache 2.0 and zope/plone with a
> plone site (call it plone-site for this question). The server with plone-site
> and apache running behind our firewall has an internal address of
> 192.168.20.130. Zope listens on port 8080, apache
> listens on port 8081.
>
> The domain registrar forwards test.com to our firewall, which is
> 58.45.32.9:8081 (again, this is not the actual IP address - I just made
> this one up for this question).
>
> Our firewall forwards the request on port 8081 to the apache server
> listening on port 8081.
>
> The apache server forwards the request to the zope/plone server on port 8080
> (same physical machine).
>
> When I type www.test.com in a browser address bar, I get the plone-site as
> expected. However, the address bar displays 58.45.32.9:8081/plone-site and
> not www.test.com. I had hoped that with url rewriting and apache I could get
> www.test.com in the address bar.

This depends on what you mean by "the domain registrar forwards...".
If they are forwarding using an HTTP redirect (and that looks to be
the case), then there is nothing you can do to change the name.  You
can't lie to the browser about the site they are being asked to fetch.

What you should do is have the registrar change DNS settings to point
to your server instead of their redirector.  You will still have a
problem with the port, since people will, by default, come in on port
80.  You should set up your proxy on port 80 and then you can use a
proxying RewriteRule like what you suggested to hide the transfer
between your front-end and back-end servers.

Joshua.

---------------------------------------------------------------------
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


RE: [users@httpd] URL Rewriting Question

Posted by Carles Güell <ca...@guellconsulting.com>.
Hi Mark,

With Zope / Plone yor config in apache should be:

RewriteCond %{HTTP_HOST}   !^www\.* [NC]
RewriteCond %{HTTP_HOST}   !^$
RewriteRule ^/(.*)         http://www.%{HTTP_HOST}/$1 [L,R]
ServerName test.com
ServerAlias www.test.com
RewriteRule ^/(.*)
http://192.168.20.130:8080/VirtualHostBase/http/%{HTTP_HOST}:80/$1 [L,P] 

And in your Virtual Host Monster:
www.test.com /thefolderinyourzopeinstance



Or simply use:

RewriteRule ^/(.*)
http://192.168.20.163:8080/VirtualHostBase/http/%{HTTP_HOST}:80/PLONEFOLDER/
VirtualHostRoot/$1 [L,P]



Regards 

Carles Güell

 

Güell Consulting Technologies SL
C/ La Remallaire 17 Despatx 6.
CP08302 Mataró
Tel.  93.798.40.44
Fax. 93.758.86.46
www.guellconsulting.com


-----Mensaje original-----
De: Mark Phillips [mailto:mark@phillipsmarketing.biz] 
Enviado el: miércoles, 06 de septiembre de 2006 20:26
Para: users@httpd.apache.org
Asunto: [users@httpd] URL Rewriting Question

I have a domain (call it test.com for the purpose of this question - it is
not the real domain) parked with a domain name registrar.
They provide free domain name forwarding. 

I have a server behind our firewall running apache 2.0 and zope/plone with a
plone site (call it plone-site for this question). The server with
plone-site and apache running behind our firewall has an internal address of
192.168.20.130. Zope listens on port 8080, apache listens on port 8081.

The domain registrar forwards test.com to our firewall, which is
58.45.32.9:8081 (again, this is not the actual IP address - I just made this
one up for this question).

Our firewall forwards the request on port 8081 to the apache server
listening on port 8081.

The apache server forwards the request to the zope/plone server on port 8080
(same physical machine).

When I type www.test.com in a browser address bar, I get the plone-site as
expected. However, the address bar displays 58.45.32.9:8081/plone-site and
not www.test.com. I had hoped that with url rewriting and apache I could get
www.test.com in the address bar.

My rewrite rule is:
# rewrite any other access to the zope server using a proxy [P] and add the
VMH magic keywords # use %{SERVER_NAME} instead of test.com to avoid busting
the ServerAlias # %{HTTP_HOST} is bad because it may contain the port
RewriteRule ^/(.*) \
http://192.168.20.130:8080/VirtualHostBase/http/%{SERVER_NAME}:8081/plone-si
te/VirtualHostRoot/$1
[L,P]

which I took from an article describing a similar setup
(http://plone.org/documentation/tutorial/plone-apache).

How can I get www.test.com to appear in the browser address bar when I
access the site?

I realize this is a plone question as well, but I was hoping a url-rewrite
expert might know off the bat what I am doing wrong. Thanks for any help you
can provide!

Mark

---------------------------------------------------------------------
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


--
Internal Virus Database is out-of-date.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.10.9/416 - Release Date: 10/08/2006
 

-- 
Internal Virus Database is out-of-date.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.10.9/416 - Release Date: 10/08/2006
 


---------------------------------------------------------------------
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