You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Gund Wehsling <gu...@nzrides.com> on 2009/05/07 05:31:31 UTC
[users@httpd] ProxyPass and Internal URLs
Good Day
Maybe this is teh wrong way to do this, but it works in other places. I have researched this extensively and found no absolute but easy to understand way to accomplish this, so please excuse my ignorance, this post is really two weeks after I started the project.
I have one IP address and two servers. I would like to make both servers visible from that one ip based on the requested host.
This works for an Exchange server (even with SSL) on one internal host and I cannot get it to work on another host with SSL.
Here is the relevant part of the httpd.conf:
<VirtualHost 0.0.0.0:80>
ServerName publicaddress1.com
ProxyPass / http://internaladdress1.local/
ProxyPassReverse / http://internaladdress1.local/
</VirtualHost>
<VirtualHost 0.0.0.0:443>
ServerName publicaddress1.com
ProxyPass / https://internaladdress1.local/
ProxyPassReverse / https://internaladdress1.local/
</VirtualHost>
<VirtualHost 0.0.0.0:80>
ServerName publicaddress2.com
ProxyPass / http://internaladdress2.local/
ProxyPassReverse / http://internaladdress2.local/
</VirtualHost>
<VirtualHost 0.0.0.0:443>
ServerName publicaddress2.com
ProxyPass / https://internaladdress2.local/
ProxyPassReverse / https://internaladdress2.local/
# ProxyPass Support for Internal Exchange Server
ProxyPreserveHost On
#OWA % character in email subject fix
RewriteEngine On
RewriteMap percentsubject int:escape
RewriteCond $1 ^/exchange/.*\%.*$
RewriteRule (/exchange/.*) ${percentsubject:$1} [P]
#OWA
ProxyPass /exchange https://internaladdress2.local/exchange
ProxyPassReverse /exchange https://internaladdress2.local/exchange
ProxyPass /owa https://internaladdress2.local/owa
ProxyPassReverse /owa https://internaladdress2.local/owa
ProxyPass /Exchange https://internaladdress2.local/exchange
ProxyPassReverse /Exchange https://internaladdress2.local/exchange
ProxyPass /exchweb https://internaladdress2.local/exchweb
ProxyPassReverse /exchweb https://internaladdress2.local/exchweb
ProxyPass /public https://internaladdress2.local/public
ProxyPassReverse /public https://internaladdress2.local/public
ProxyPass /iisadmpwd https://internaladdress2.local/iisadmpwd
ProxyPassReverse /iisadmpwd https://internaladdress2.local/iisadmpwd
#OMA
ProxyPass /oma https://internaladdress2.local/oma
ProxyPassReverse /oma https://internaladdress2.local/oma
#ActiveSync (for WM5+ devices)
ProxyPass /Microsoft-Server-ActiveSync https://internaladdress2.local/Microsoft-Server-ActiveSync
ProxyPassReverse /Microsoft-Server-ActiveSync https://internaladdress2.local/Microsoft-Server-ActiveSync
# End of Exchange settings
</VirtualHost>
Seriously I have been at this over a week now, and here is what happens:
1. If I open http://publicaddress2.com, I get http://internaladdress2.local contents and the browser address bar shows http://publicaddress2.com and all the relevant links work fine, the site functions well and as expected.
2. If I open http://publicaddress1.com<http://publicaddress1.com/>, I get http://internaladdress1.local<http://internaladdress1.local/> contents and the browser address bar shows http://publicaddress1.com<http://publicaddress1.com/> and all the relevant link work fine, the site functions well and as expected.
3. If I open https://publicaddress2.com, I get https://internaladdress2.local contents and the browser address bar shows http://publicaddress2.com and all the relevant link work fine, the site functions well and as expected. All the virtual directories and all Exchange functionality is fine, so I know the links all work as do the script requests etc.
4. But, for some reason, if I open https://publicaddress1.com, I get 404 and the browser address bar shows http://internaladdress1.com and all the relevant link work fine, the site functions well and as exzpected. I tried to rewrite with as much mixed success as there are opinions to do this...
Any help is greatly appreciated, I know from my research there are a heap of people battlinf with this, so I am confident a solution will be suitable for many users, not just me.
Many thanks in advance.
Gund
Re: [users@httpd] ProxyPass and Internal URLs
Posted by John Oliver <jo...@john-oliver.net>.
On Thu, May 07, 2009 at 12:02:40PM -0400, Eric Covener wrote:
> On Wed, May 6, 2009 at 11:31 PM, Gund Wehsling <gu...@nzrides.com> wrote:
> > 4. But, for some reason, if I open https://publicaddress1.com, I get 404 and
> > the browser address bar shows http://internaladdress1.com and all the
> > relevant link work fine, the site functions well and as exzpected. I tried
> > to rewrite with as much mixed success as there are opinions to do this...
>
> It sounds like your ProxyPassReverse failed to do the right thing, and
> a redirect leaked out. I assume for most users, "internaladdress1.com"
> in the browser would be game over.
I just set up something like this, where a Red Hat Linux host has a
public IP and redirects certain URLs to Tomcat on a Windows machine via
a private network. A single ProxyPass line worked for me... the "Proxy"
implies that the Apache httpd on the host with the public address is
actually proxying, not redirecting, and so the private IP should never
be visible to the client.
Try commenting out the ProxyPassReverse I don't think you need it.
--
***********************************************************************
* John Oliver http://www.john-oliver.net/ *
* *
***********************************************************************
---------------------------------------------------------------------
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] ProxyPass and Internal URLs
Posted by Gund Wehsling <gu...@nzrides.com>.
Hi
Thanks for the quick response.
<snip>
It sounds like your ProxyPassReverse failed to do the right thing, and
a redirect leaked out. I assume for most users, "internaladdress1.com"
in the browser would be game over.
</snip>
Yes, internaladdress1.com is not routable or resolvable unless you are on the LAN, it is an independent and random address and domain. The browser trying to get there results in the 404.
<snip>
I assume you have NameVirtualHost 0.0.0.0:443 (your symptom doesn't
match this error, but it's a common error)
Can you paste apache2ctl (or apachectl/httpd) -S ?
</snip>
I am using SMEServer 7.4 distro and there is no apachectl on the volume. The output of httpd -S is here:
[root@server11 /]# /usr/sbin/httpd -S
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:443 is a NameVirtualHost
default server internaladdress1.com (/etc/httpd/conf/httpd.conf:591)
port 443 namevhost internaladdress1.com (/etc/httpd/conf/httpd.conf:591)
port 443 namevhost publicaddress1.com (/etc/httpd/conf/httpd.conf:701)
port 443 namevhost publicaddress2.com (/etc/httpd/conf/httpd.conf:799)
port 443 namevhost host1.publicaddress2.com (/etc/httpd/conf/httpd.conf:1103)
port 443 namevhost host2.publicaddress2.com (/etc/httpd/conf/httpd.conf:1120)
*:80 is a NameVirtualHost
default server internaladdress1.com (/etc/httpd/conf/httpd.conf:532)
port 80 namevhost internaladdress1.com (/etc/httpd/conf/httpd.conf:532)
port 80 namevhost publicaddress1.com (/etc/httpd/conf/httpd.conf:654)
port 80 namevhost publicaddress2.com (/etc/httpd/conf/httpd.conf:752)
port 80 namevhost host1.publicaddress2.com (/etc/httpd/conf/httpd.conf:1097)
port 80 namevhost host2.publicaddress2.com (/etc/httpd/conf/httpd.conf:1114)
Syntax OK
[root@server11 /]#
As you can see, I have everything on a private LAN and I enjoy the security benefits of reverse proxy. The publicaddress1 and publicaddress2 are both domains I own. Everything resolves to a fixed address I own and I use the Apache server to send the incoming requets to either an Exchange box (host1) or another SMEServer (host2), depending on the FQDN. Everything works except OSCommerce on another SMEServer 7.4 (host2).
OSCommerce requires that from the web the users and administrator can 'see' FQDN/oscommerce and FQDN/oscommerce/admin. I was hoping that PROXYPASS would allow everything from / to be proxy'd out, but looking at how Exchange is reverse proxy'd (each virtual directory is explicitly detailed), I added a few lines into the PROXYPASS statement to explicitly handle /oscommerce and /oscommerce/admin as well as / and it works!
I am not sure if this is a short comming of reverse proxy HTTPS (because it works fine in HTTP for any non-explicit virtual directory), or I have misread or misinterpreted the documentation.
I am okay with it as it is now, because ultimately, this means only explicit redirects work, which is a security feature for me, but perhaps somebody else wants to make this work if it is indeed a problem with code.
For reference, I did have to enable SSL proxy:
SSLProxyEngine on
before any of the PROXYPASS stuff would work in HTTPS.
Many thanks for all your help, I am very happy with the product and most definitely the support.
I am also happy this is resolved, unless somebody else is concerned that each Virtual Directoy needs to be explicit.
Gund
---------------------------------------------------------------------
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] ProxyPass and Internal URLs
Posted by Eric Covener <co...@gmail.com>.
On Wed, May 6, 2009 at 11:31 PM, Gund Wehsling <gu...@nzrides.com> wrote:
> 4. But, for some reason, if I open https://publicaddress1.com, I get 404 and
> the browser address bar shows http://internaladdress1.com and all the
> relevant link work fine, the site functions well and as exzpected. I tried
> to rewrite with as much mixed success as there are opinions to do this...
It sounds like your ProxyPassReverse failed to do the right thing, and
a redirect leaked out. I assume for most users, "internaladdress1.com"
in the browser would be game over.
I assume you have NameVirtualHost 0.0.0.0:443 (your symptom doesn't
match this error, but it's a common error)
Can you paste apache2ctl (or apachectl/httpd) -S ?
--
Eric Covener
covener@gmail.com
---------------------------------------------------------------------
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