You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Greg Donhardt <do...@tpg.com.au> on 2004/08/12 13:28:27 UTC

[users@httpd] Trouble with Rewrite

I am running Apache (2.0.50) on a Windows XP box and am hosting several 
websites with various domains. On the same machine I am also running 
Ability Mailserver which serves mail for all these domains. Ability has a 
webmail service which runs on port 8000. To access the webmail the url is 
http://www.users.domain.com.au:8000 which brings up the webmail page. I 
want to set it up so that users who want to access their webmail do not 
have to worry about ports, so I have setup a redirect within Apache to 
point the /webmail directory, ie http://www.users.domain.com.au/webmail to 
redirect to http://www.usersdomain.com.au:8000. What I am wanting to do, 
however, is stop the URL from changing within the location bar of the 
browser as it currently does using the redirect. I have looked at a few 
pages and noticed that it should be possible using the rewrite module in 
Apache but I just cant work it out. Any help would be greatly appreciated

Greg


---------------------------------------------------------------------
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] Trouble with Rewrite

Posted by Joshua Slive <js...@gmail.com>.
On Thu, 12 Aug 2004 20:58:27 +0930, Greg Donhardt <do...@tpg.com.au> wrote:
> I am running Apache (2.0.50) on a Windows XP box and am hosting several
> websites with various domains. On the same machine I am also running
> Ability Mailserver which serves mail for all these domains. Ability has a
> webmail service which runs on port 8000. To access the webmail the url is
> http://www.users.domain.com.au:8000 which brings up the webmail page. I
> want to set it up so that users who want to access their webmail do not
> have to worry about ports, so I have setup a redirect within Apache to
> point the /webmail directory, ie http://www.users.domain.com.au/webmail to
> redirect to http://www.usersdomain.com.au:8000. What I am wanting to do,
> however, is stop the URL from changing within the location bar of the
> browser as it currently does using the redirect. I have looked at a few
> pages and noticed that it should be possible using the rewrite module in
> Apache but I just cant work it out. Any help would be greatly appreciated

The only way to do this is have apache proxy the requests (grab them
from the other server and return them to the client) rather than
redirecting the client.

You can use something like
ProxyPass /webmail http://www.usersdomain.com.au:8000/
ProxyPassReverse /webmail http://www.usersdomain.com.au:8000/
Make sure you have mod_proxy included in your server.

Note that this will only work if your backend server (on port 8000)
doesn't use any absolute URLs in its links, since these URLs will
escape the proxy.  There are certain ways to try to work around this
if necessary.

See also:
http://www.apacheweek.com/features/reverseproxies

Joshua.

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