You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by H Plato <hp...@gmail.com> on 2014/11/19 02:38:46 UTC

[users@httpd] Proxy problems when using subdirectory

I’m having problems getting a reverse proxy to work as a subdirectory. Using the following configuration, Apache can full proxy an internal site:

<VirtualHost 192.168.0.50:80>
	ServerName www.domain.com
 	DocumentRoot /data/www/www
 	ErrorLog /var/log/apache2/www_error_log
 	TransferLog /var/log/apache2/www_access_log

	<Directory "/">
		Options Indexes FollowSymLinks ExecCGI
	 	AllowOverride AuthConfig
                Order allow,deny
		Allow from all
		AllowOverride All
		Require all granted
	</Directory> 

       ProxyRequests Off
       ProxyPass / http://192.168.0.51:80/ 
       ProxyPassReverse / http://192.168.0.51:80/ 
       ServerAlias www.proxy.domain.com
       ServerName proxy.domain.com
	
</VirtualHost>

However, when I change the proxy statements to use a subdomain:

       ProxyPass /a/ http://192.168.0.51:80/ 
       ProxyPassReverse /a/ http://192.168.0.51:80/ 

 then I get inconsistent results. Any link on the internal site that has root link (i.e.. href=“/docs” ) none of these are proxied to /a/docs. Any link with a relative link (i.e. href=“docs”) works.

I’m using Ubuntu 14.04.1 with  Apache/2.4.7 (Ubuntu) Server built:   Jul 22 2014 14:36:38

I’ve been struggling with this for days, so any ideas or help would be greatly appreciated.



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Proxy problems when using subdirectory

Posted by H Plato <hp...@gmail.com>.
Thanks for the suggestion, but still no success. Again /a/ works, but any link in the proxied site that begins with “/“ does not.

Nothing interesting in the logs, either: the error log has a few of these entries:

[Wed Nov 19 19:51:58.309834 2014] [include:warn] [pid 22620] [client 192.168.3.184:63724] AH01374: mod_include: Options +Includes (or IncludesNoExec) wasn't set, INCLUDES filter removed: /a/site/menu.shtml, referer: http://www/a/site/index.shtml

From the access log, I can see the problematic URLs and the resulting 404 errors:

192.168.3.184 - - [19/Nov/2014:19:51:55 -0700] "GET /a/site/top.shtml HTTP/1.1" 200 485
192.168.3.184 - - [19/Nov/2014:19:51:55 -0700] "GET /default.css HTTP/1.1" 404 277
192.168.3.184 - - [19/Nov/2014:19:51:55 -0700] "GET /site/images/lo.gif HTTP/1.1" 404 294
192.168.3.184 - - [19/Nov/2014:19:51:55 -0700] "GET /site/images/pa.gif HTTP/1.1" 404 289
192.168.3.184 - - [19/Nov/2014:19:51:55 -0700] "GET /a/site/menu.shtml HTTP/1.1" 200 1414
192.168.3.184 - - [19/Nov/2014:19:51:55 -0700] "GET /default.css HTTP/1.1" 404 277
192.168.3.184 - - [19/Nov/2014:19:51:55 -0700] "GET /default.css HTTP/1.1" 404 277
192.168.3.184 - - [19/Nov/2014:19:51:58 -0700] "GET /a/site/index.shtml HTTP/1.1" 200 374
192.168.3.184 - - [19/Nov/2014:19:51:58 -0700] "GET /default.css HTTP/1.1" 404 277

> On Nov 19, 2014, at 2:37 PM, Igor Cicimov <ic...@gmail.com> wrote:
> 
> 
> On 20/11/2014 1:04 AM, "H Plato" <hplato@gmail.com <ma...@gmail.com>> wrote:
> >
> > Thanks Eric,
> >
> > I've tried so many combinations of this with no success, both in and out of a location block. This should work according to the docs, but it doesn't (i'm writing this from memory so might have syntax wrong):
> >
> > <location /a/>
> >   ProxyHTMLURLMap / /a/
> >   ProxyHTMLURLMap /bin/  /a/bin/
> > </location>
> >
> > Sent from my mobile device.
> >
> Try this in the vhost
> 
> ProxyHTMLEnable On
> ProxyPass /a/ http://192.168.0.51:80/ <http://192.168.0.51/>
> ProxyPassReverse /a/ http://192.168.0.51:80/ <http://192.168.0.51/>
> ProxyHTMLURLMap http://192.168.0.51:80/ <http://192.168.0.51/> /a/


Re: [users@httpd] Proxy problems when using subdirectory

Posted by Igor Cicimov <ic...@gmail.com>.
On 20/11/2014 1:04 AM, "H Plato" <hp...@gmail.com> wrote:
>
> Thanks Eric,
>
> I've tried so many combinations of this with no success, both in and out
of a location block. This should work according to the docs, but it doesn't
(i'm writing this from memory so might have syntax wrong):
>
> <location /a/>
>   ProxyHTMLURLMap / /a/
>   ProxyHTMLURLMap /bin/  /a/bin/
> </location>
>
> Sent from my mobile device.
>
Try this in the vhost

ProxyHTMLEnable On
ProxyPass /a/ http://192.168.0.51:80/
ProxyPassReverse /a/ http://192.168.0.51:80/
ProxyHTMLURLMap http://192.168.0.51:80/ /a/

Re: [users@httpd] Proxy problems when using subdirectory

Posted by H Plato <hp...@gmail.com>.
Thanks Eric,  

I've tried so many combinations of this with no success, both in and out of a location block. This should work according to the docs, but it doesn't (i'm writing this from memory so might have syntax wrong):

<location /a/>
  ProxyHTMLURLMap / /a/
  ProxyHTMLURLMap /bin/  /a/bin/
</location>

Sent from my mobile device. 

> On Nov 19, 2014, at 6:02 AM, Eric Covener <co...@gmail.com> wrote:
> 
>> On Tue, Nov 18, 2014 at 8:38 PM, H Plato <hp...@gmail.com> wrote:
>> then I get inconsistent results. Any link on the internal site that has root link (i.e.. href=“/docs” ) none of these are proxied to /a/docs. Any link with a relative link (i.e. href=“docs”) works.
> 
> mod_proxy_html can fix your links.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Proxy problems when using subdirectory

Posted by Eric Covener <co...@gmail.com>.
On Tue, Nov 18, 2014 at 8:38 PM, H Plato <hp...@gmail.com> wrote:
>  then I get inconsistent results. Any link on the internal site that has root link (i.e.. href=“/docs” ) none of these are proxied to /a/docs. Any link with a relative link (i.e. href=“docs”) works.

mod_proxy_html can fix your links.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


RE: [users@httpd] Proxy problems when using subdirectory (UNCLASSIFIED)

Posted by "Folino, Nick E CTR USARMY HRC (US)" <ni...@mail.mil>.
Classification: UNCLASSIFIED
Caveats: FOUO

Your configuration:

     ProxyPass /a/ http://192.168.0.51:80/
     ProxyPassReverse /a/ http://192.168.0.51:80/

Will not proxy /docs to /a/docs. For that you need:

     ProxyPass / http://192.168.0.51:80/a/
     ProxyPassReverse / http://192.168.0.51:80/a/

Nick


-----Original Message-----
From: H Plato [mailto:hplato@gmail.com] 
Sent: Wednesday, November 19, 2014 10:01 PM
To: users@httpd.apache.org
Subject: Re: [users@httpd] Proxy problems when using subdirectory

So I put this in a <location /a/> block so that only those URLs get written. No success. Thanks for the suggestion though.


	On Nov 19, 2014, at 3:26 PM, Otis DeWitt <ot...@noaa.gov> wrote:

	Try adding:

	RewriteRule   ^(.*)$   http://www.domain.com/ <http://www.domain2.com/> $1   [R=301,L]
	
	Sent from my iPhone

	On Nov 18, 2014, at 8:38 PM, H Plato <hp...@gmail.com> wrote:
	
	

		I’m having problems getting a reverse proxy to work as a subdirectory. Using the following configuration, Apache can full proxy an internal site:
		
		<VirtualHost 192.168.0.50:80>
		   ServerName www.domain.com <http://www.domain.com/> 
		   DocumentRoot /data/www/www
		   ErrorLog /var/log/apache2/www_error_log
		   TransferLog /var/log/apache2/www_access_log
		
		   <Directory "/">
		       Options Indexes FollowSymLinks ExecCGI
		       AllowOverride AuthConfig
		               Order allow,deny
		       Allow from all
		       AllowOverride All
		       Require all granted
		   </Directory> 
		
		      ProxyRequests Off
		      ProxyPass / http://192.168.0.51:80/ <http://192.168.0.51/>  
		      ProxyPassReverse / http://192.168.0.51:80/ <http://192.168.0.51/>  
		      ServerAlias www.proxy.domain.com <http://www.proxy.domain.com/> 
		      ServerName proxy.domain.com <http://proxy.domain.com/> 
		   
		</VirtualHost>
		
		However, when I change the proxy statements to use a subdomain:
		
		      ProxyPass /a/ http://192.168.0.51:80/ <http://192.168.0.51/>  
		      ProxyPassReverse /a/ http://192.168.0.51:80/ <http://192.168.0.51/>  
		
		then I get inconsistent results. Any link on the internal site that has root link (i.e.. href=“/docs” ) none of these are proxied to /a/docs. Any link with a relative link (i.e. href=“docs”) works.
		
		I’m using Ubuntu 14.04.1 with  Apache/2.4.7 (Ubuntu) Server built:   Jul 22 2014 14:36:38
		
		I’ve been struggling with this for days, so any ideas or help would be greatly appreciated.
		
		
		
		---------------------------------------------------------------------
		To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
		For additional commands, e-mail: users-help@httpd.apache.org
		
		



Classification: UNCLASSIFIED
Caveats: FOUO



Re: [users@httpd] Proxy problems when using subdirectory

Posted by H Plato <hp...@gmail.com>.
So I put this in a <location /a/> block so that only those URLs get written. No success. Thanks for the suggestion though.

> On Nov 19, 2014, at 3:26 PM, Otis DeWitt <ot...@noaa.gov> wrote:
> 
> Try adding:
> 
> RewriteRule   ^(.*)$   http://www.domain.com/ <http://www.domain2.com/>$1   [R=301,L]
> 
> Sent from my iPhone
> 
> On Nov 18, 2014, at 8:38 PM, H Plato <hplato@gmail.com <ma...@gmail.com>> wrote:
> 
>> I’m having problems getting a reverse proxy to work as a subdirectory. Using the following configuration, Apache can full proxy an internal site:
>> 
>> <VirtualHost 192.168.0.50:80>
>>    ServerName www.domain.com <http://www.domain.com/>
>>    DocumentRoot /data/www/www
>>    ErrorLog /var/log/apache2/www_error_log
>>    TransferLog /var/log/apache2/www_access_log
>> 
>>    <Directory "/">
>>        Options Indexes FollowSymLinks ExecCGI
>>        AllowOverride AuthConfig
>>                Order allow,deny
>>        Allow from all
>>        AllowOverride All
>>        Require all granted
>>    </Directory> 
>> 
>>       ProxyRequests Off
>>       ProxyPass / http://192.168.0.51:80/ <http://192.168.0.51/> 
>>       ProxyPassReverse / http://192.168.0.51:80/ <http://192.168.0.51/> 
>>       ServerAlias www.proxy.domain.com <http://www.proxy.domain.com/>
>>       ServerName proxy.domain.com <http://proxy.domain.com/>
>>    
>> </VirtualHost>
>> 
>> However, when I change the proxy statements to use a subdomain:
>> 
>>       ProxyPass /a/ http://192.168.0.51:80/ <http://192.168.0.51/> 
>>       ProxyPassReverse /a/ http://192.168.0.51:80/ <http://192.168.0.51/> 
>> 
>> then I get inconsistent results. Any link on the internal site that has root link (i.e.. href=“/docs” ) none of these are proxied to /a/docs. Any link with a relative link (i.e. href=“docs”) works.
>> 
>> I’m using Ubuntu 14.04.1 with  Apache/2.4.7 (Ubuntu) Server built:   Jul 22 2014 14:36:38
>> 
>> I’ve been struggling with this for days, so any ideas or help would be greatly appreciated.
>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org <ma...@httpd.apache.org>
>> For additional commands, e-mail: users-help@httpd.apache.org <ma...@httpd.apache.org>
>> 


Re: [users@httpd] Proxy problems when using subdirectory

Posted by Otis DeWitt <ot...@noaa.gov>.
Try adding:

RewriteRule   ^(.*)$   http://www.domain.com/$1   [R=301,L]

Sent from my iPhone

> On Nov 18, 2014, at 8:38 PM, H Plato <hp...@gmail.com> wrote:
> 
> I’m having problems getting a reverse proxy to work as a subdirectory. Using the following configuration, Apache can full proxy an internal site:
> 
> <VirtualHost 192.168.0.50:80>
>    ServerName www.domain.com
>    DocumentRoot /data/www/www
>    ErrorLog /var/log/apache2/www_error_log
>    TransferLog /var/log/apache2/www_access_log
> 
>    <Directory "/">
>        Options Indexes FollowSymLinks ExecCGI
>        AllowOverride AuthConfig
>                Order allow,deny
>        Allow from all
>        AllowOverride All
>        Require all granted
>    </Directory> 
> 
>       ProxyRequests Off
>       ProxyPass / http://192.168.0.51:80/ 
>       ProxyPassReverse / http://192.168.0.51:80/ 
>       ServerAlias www.proxy.domain.com
>       ServerName proxy.domain.com
>    
> </VirtualHost>
> 
> However, when I change the proxy statements to use a subdomain:
> 
>       ProxyPass /a/ http://192.168.0.51:80/ 
>       ProxyPassReverse /a/ http://192.168.0.51:80/ 
> 
> then I get inconsistent results. Any link on the internal site that has root link (i.e.. href=“/docs” ) none of these are proxied to /a/docs. Any link with a relative link (i.e. href=“docs”) works.
> 
> I’m using Ubuntu 14.04.1 with  Apache/2.4.7 (Ubuntu) Server built:   Jul 22 2014 14:36:38
> 
> I’ve been struggling with this for days, so any ideas or help would be greatly appreciated.
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 

Re: [users@httpd] Proxy problems when using subdirectory

Posted by H Plato <hp...@gmail.com>.
Just a cut’n’paste typo.
> On Nov 19, 2014, at 1:27 AM, Igor Cicimov <ic...@gmail.com> wrote:
> 
> 
> On 19/11/2014 12:39 PM, "H Plato" <hplato@gmail.com <ma...@gmail.com>> wrote:
> >
> > I’m having problems getting a reverse proxy to work as a subdirectory. Using the following configuration, Apache can full proxy an internal site:
> >
> > <VirtualHost 192.168.0.50:80 <http://192.168.0.50/>>
> >         ServerName www.domain.com <http://www.domain.com/>
> >         DocumentRoot /data/www/www
> >         ErrorLog /var/log/apache2/www_error_log
> >         TransferLog /var/log/apache2/www_access_log
> >
> >         <Directory "/">
> >                 Options Indexes FollowSymLinks ExecCGI
> >                 AllowOverride AuthConfig
> >                 Order allow,deny
> >                 Allow from all
> >                 AllowOverride All
> >                 Require all granted
> >         </Directory>
> >
> >        ProxyRequests Off
> >        ProxyPass / http://192.168.0.51:80/ <http://192.168.0.51/>
> >        ProxyPassReverse / http://192.168.0.51:80/ <http://192.168.0.51/>
> >        ServerAlias www.proxy.domain.com <http://www.proxy.domain.com/>
> >        ServerName proxy.domain.com <http://proxy.domain.com/>
> >
> > </VirtualHost>
> Do you really have two ServerName statements in the vhost or is it just a typo?


Re: [users@httpd] Proxy problems when using subdirectory

Posted by Igor Cicimov <ic...@gmail.com>.
On 19/11/2014 12:39 PM, "H Plato" <hp...@gmail.com> wrote:
>
> I’m having problems getting a reverse proxy to work as a subdirectory.
Using the following configuration, Apache can full proxy an internal site:
>
> <VirtualHost 192.168.0.50:80>
>         ServerName www.domain.com
>         DocumentRoot /data/www/www
>         ErrorLog /var/log/apache2/www_error_log
>         TransferLog /var/log/apache2/www_access_log
>
>         <Directory "/">
>                 Options Indexes FollowSymLinks ExecCGI
>                 AllowOverride AuthConfig
>                 Order allow,deny
>                 Allow from all
>                 AllowOverride All
>                 Require all granted
>         </Directory>
>
>        ProxyRequests Off
>        ProxyPass / http://192.168.0.51:80/
>        ProxyPassReverse / http://192.168.0.51:80/
>        ServerAlias www.proxy.domain.com
>        ServerName proxy.domain.com
>
> </VirtualHost>
Do you really have two ServerName statements in the vhost or is it just a
typo?