You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "Michael Schoenboeck - domaintechnik.at" <ms...@domaintechnik.at> on 2005/09/06 09:05:23 UTC

[users@httpd] Problem with (SSL)ReverseProxy and redirects (HTTP/1.1 302)

Hi,

I have a very big problem with ReverseProxy and CGI/PHP http-redirects.

I have three domains, e.g. domainEXT.xy, domainINT1.xy and domainINT2.xy
(The INT domains are on another server)
For domainEXT.xy i hafe a SSL-cert. (https://domainEXT.xy) works fine.
So i had the idea to make a ReverseProxy for the another 2 domains, to make them secure.
E.g.
https://domainEXT.xy/domainINT1.xy/
https://domainEXT.xy/domainINT2.xy/

On Apache 2.0.54/win32 i activeted now mod_proxy, mod_proxy_http, mod_proxy_connect and mod_proxy_html

And wrote the folowing in the httpd.conf
<VirtualHost ...:443>
  ServerName domainext.xy
  ### SSL config here ###
  ProxyRequests off
  ProxyPass /domainint1.xy/ http://domainint1.xy/
  ProxyHTMLURLMap http://domainint1.xy /domainint1.xy
  <Location /domainint1.xy/>
    ProxyPassReverse /
    SetOutputFilter proxy-html
    ProxyHTMLURLMap / /domainint1.xy/
    ProxyHTMLURLMap /domainint1.xy /domainint1.xy
    RequestHeader unset Accept-Encoding
  </Location>
  ProxyPass /domainint2.xy/ http://domainint2.xy/
  ProxyHTMLURLMap http://domainint2.xy /domainint2.xy
  <Location /domainint2.xy/>
    ProxyPassReverse /
    SetOutputFilter proxy-html
    ProxyHTMLURLMap / /domainint2.xy/
    ProxyHTMLURLMap /domainint2.xy /domainint2.xy
    RequestHeader unset Accept-Encoding
  </Location>
  Options -Indexes MultiViews
  DirectoryIndex index.php
  DocumentRoot "/web/public/"
</VirtualHost>

This works realy fine, but:
Now i hafe a script on http://domainINT2.xy/file.php in this file there is a header redirect:
HTTP/1.1 302
Location: http://domainINT2.xy/file2.php
Without the Proxy it will work, but if i call https://domainEXT.xy/domainINT2.xy/file.php it makes also a redirect to http://domainINT2.xy/file2.php and not to https://domainEXT.xy/domainINT2.xy/file2.php

Now my question:
How can i say mod_proxy* also to rewrite this Location headers if in it the domain name?
(cos i can't modify the scripts of the domainINT* domain names.)
I am shure this must work, but i don't know how?

I hope you can help please, and sorry for my bad english!

Greetings
Michael


---------------------------------------------------------------------
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] Virtual host config SOLVED

Posted by Vizion <vi...@vizion.occoxmail.com>.
On Tuesday 06 September 2005 16:09,  the author Vizion contributed to the 
dialogue on-
 Re: [users@httpd] Virtual host config: 

>On Tuesday 06 September 2005 10:20,  the author Vizion contributed to the
>dialogue on-
>
> [users@httpd] Virtual host config:
>>Hi
>>
>>My Apache2 runs on Unix (Freebsd) with
>>httpd.conf including
>>ServerRoot "/usr/local"
>>DocumentRoot "/usr/local/www/data"
>>
>>It is so long ago that I was working on apache that I have forgotten the
>>basics!
>>
>>I am adding a number of virtual hosts the files  located as
>>
>>/usr2/virtualhosts/vhostname1/
>>/usr2/virtualhosts/vhostname2/
>>etc
>>
>>I want to keep the existing website running under /usr/local/www/data as
>> well as the virtual hosts.
>>
>>I do not want to try the Virtual-Host Aliases until I have got my head
>> around the basics!
>>
>>I have set up a virtualhosts.conf file using an Include directory:
>>
>>Include etc/apache2/Includes/*.conf
>>
>><VirtualHost x.x.x.x>
>>        DocumentRoot /usr2/virtualwebs/vhostname1
>>        ServerName vhostname1.com
>>        AcceptPathInfo On
>></VirtualHost>
>>
>>I am clearly not getting my set up/permissions right because I get
>>
>>You don't have permission to access / on this server.
>>
>>It seems  some needed directives are missing from the virtualhosts.conf
>> and/or httpd.conf files.
>>
>>Despite reading the documentation I do not get it!
>
>I have also tried using a link
>dns1# cd www
>dns1# ls -l
>total 14
>
>lrwxr-xr-x  1 root  wheel    18 Sep  6 14:20 virtualwebs ->
> /usr2/virtualwebs/
>
>with virtualhosts.conf carrying entries of:
>
><VirtualHost x.x.x.x>
>	DocumentRoot /www/virtualwebs/vhost1.com
>	ServerName vhost1.com
>	AcceptPathInfo On
></VirtualHost>
>and tried
><VirtualHost x.x.x.x>
>	DocumentRoot /virtualwebs/vhost1.com
>	ServerName vhost1.com
>	AcceptPathInfo On
></VirtualHost>
>when that did not work
>In either case I get
>Warning: DocumentRoot [/www/virtualwebs/vhost1.com] does not exist
>
>How can I get this right?

OK solved it - the manual I was using gave the impression that the 
DocumentRoot was specified relative to the server root rather than 
absolutely. Once I got over that the rest fell into place.

Thanks
david

-- 
40 yrs navigating and computing in blue waters.
English Owner & Captain of British Registered 60' bluewater Ketch S/V Taurus.
 Currently in San Diego, CA. Sailing bound for Europe via Panama Canal after 
completing engineroom refit.

---------------------------------------------------------------------
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] Virtual host config

Posted by Vizion <vi...@vizion.occoxmail.com>.
On Tuesday 06 September 2005 10:20,  the author Vizion contributed to the 
dialogue on-
 [users@httpd] Virtual host config: 

>Hi
>
>My Apache2 runs on Unix (Freebsd) with
>httpd.conf including
>ServerRoot "/usr/local"
>DocumentRoot "/usr/local/www/data"
>
>It is so long ago that I was working on apache that I have forgotten the
>basics!
>
>I am adding a number of virtual hosts the files  located as
>
>/usr2/virtualhosts/vhostname1/
>/usr2/virtualhosts/vhostname2/
>etc
>
>I want to keep the existing website running under /usr/local/www/data as
> well as the virtual hosts.
>
>I do not want to try the Virtual-Host Aliases until I have got my head
> around the basics!
>
>I have set up a virtualhosts.conf file using an Include directory:
>
>Include etc/apache2/Includes/*.conf
>
><VirtualHost x.x.x.x>
>        DocumentRoot /usr2/virtualwebs/vhostname1
>        ServerName vhostname1.com
>        AcceptPathInfo On
></VirtualHost>
>
>I am clearly not getting my set up/permissions right because I get
>
>You don't have permission to access / on this server.
>
>It seems  some needed directives are missing from the virtualhosts.conf
> and/or httpd.conf files.
>
>Despite reading the documentation I do not get it!

I have also tried using a link
dns1# cd www
dns1# ls -l
total 14

lrwxr-xr-x  1 root  wheel    18 Sep  6 14:20 virtualwebs -> /usr2/virtualwebs/
 
with virtualhosts.conf carrying entries of:

<VirtualHost x.x.x.x>
	DocumentRoot /www/virtualwebs/vhost1.com
	ServerName vhost1.com
	AcceptPathInfo On
</VirtualHost>
and tried
<VirtualHost x.x.x.x>
	DocumentRoot /virtualwebs/vhost1.com
	ServerName vhost1.com
	AcceptPathInfo On
</VirtualHost>
when that did not work
In either case I get
Warning: DocumentRoot [/www/virtualwebs/vhost1.com] does not exist

How can I get this right?
david

-- 
40 yrs navigating and computing in blue waters.
English Owner & Captain of British Registered 60' bluewater Ketch S/V Taurus.
 Currently in San Diego, CA. Sailing bound for Europe via Panama Canal after 
completing engineroom refit.

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


[users@httpd] Virtual host config

Posted by Vizion <vi...@vizion.occoxmail.com>.
Hi

My Apache2 runs on Unix (Freebsd) with 
httpd.conf including
ServerRoot "/usr/local"
DocumentRoot "/usr/local/www/data"

It is so long ago that I was working on apache that I have forgotten the 
basics!

I am adding a number of virtual hosts the files  located as

/usr2/virtualhosts/vhostname1/
/usr2/virtualhosts/vhostname2/
etc

I want to keep the existing website running under /usr/local/www/data as well 
as the virtual hosts.

I do not want to try the Virtual-Host Aliases until I have got my head around 
the basics!

I have set up a virtualhosts.conf file using an Include directory:

Include etc/apache2/Includes/*.conf

<VirtualHost x.x.x.x>
        DocumentRoot /usr2/virtualwebs/vhostname1
        ServerName vhostname1.com
        AcceptPathInfo On
</VirtualHost>

I am clearly not getting my set up/permissions right because I get

You don't have permission to access / on this server.

It seems  some needed directives are missing from the virtualhosts.conf and/or 
httpd.conf files.

Despite reading the documentation I do not get it!

Can someone please help

thanks in advance

david


-- 
40 yrs navigating and computing in blue waters.
English Owner & Captain of British Registered 60' bluewater Ketch S/V Taurus.
 Currently in San Diego, CA. Sailing bound for Europe via Panama Canal after 
completing engineroom refit.

---------------------------------------------------------------------
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] Problem with (SSL)ReverseProxy and redirects(HTTP/1.1 302)

Posted by Joshua Slive <js...@gmail.com>.
On 9/6/05, Michael Schoenboeck - domaintechnik.at <ms...@domaintechnik.at> wrote:
> Hi,
> 
> > quick read of your mail
> >
> > arent you missing the ProxyPassReverse directive?
> >
> > ./allan
> 
> Sorry, i think this is not the problem, cos i have used it from this
> example:
> http://www.apacheweek.com/features/reverseproxies
> 
> But i don't know how to fix this with the redirects.

ProxyPassReverse is exactly intended to fix the redirects.

Try using the form of ProxyPassReverse that goes outside the
<Location> sections; give it exactly the same arguments as ProxyPass.

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


AW: [users@httpd] Problem with (SSL)ReverseProxy and redirects(HTTP/1.1 302)

Posted by "Michael Schoenboeck - domaintechnik.at" <ms...@domaintechnik.at>.
Hi,

> quick read of your mail
> 
> arent you missing the ProxyPassReverse directive?
> 
> ./allan

Sorry, i think this is not the problem, cos i have used it from this
example:
http://www.apacheweek.com/features/reverseproxies

But i don't know how to fix this with the redirects.

Greetings
Michael


---------------------------------------------------------------------
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] Problem with (SSL)ReverseProxy and redirects (HTTP/1.1 302)

Posted by al...@muly.dk.
Quoting "Michael Schoenboeck - domaintechnik.at" <ms...@domaintechnik.at>:

quick read of your mail

arent you missing the ProxyPassReverse directive?

./allan




> Hi,
>
> I have a very big problem with ReverseProxy and CGI/PHP http-redirects.
>
> I have three domains, e.g. domainEXT.xy, domainINT1.xy and domainINT2.xy
> (The INT domains are on another server)
> For domainEXT.xy i hafe a SSL-cert. (https://domainEXT.xy) works fine.
> So i had the idea to make a ReverseProxy for the another 2 domains, 
> to make them secure.
> E.g.
> https://domainEXT.xy/domainINT1.xy/
> https://domainEXT.xy/domainINT2.xy/
>
> On Apache 2.0.54/win32 i activeted now mod_proxy, mod_proxy_http, 
> mod_proxy_connect and mod_proxy_html
>
> And wrote the folowing in the httpd.conf
> <VirtualHost ...:443>
>  ServerName domainext.xy
>  ### SSL config here ###
>  ProxyRequests off
>  ProxyPass /domainint1.xy/ http://domainint1.xy/
>  ProxyHTMLURLMap http://domainint1.xy /domainint1.xy
>  <Location /domainint1.xy/>
>    ProxyPassReverse /
>    SetOutputFilter proxy-html
>    ProxyHTMLURLMap / /domainint1.xy/
>    ProxyHTMLURLMap /domainint1.xy /domainint1.xy
>    RequestHeader unset Accept-Encoding
>  </Location>
>  ProxyPass /domainint2.xy/ http://domainint2.xy/
>  ProxyHTMLURLMap http://domainint2.xy /domainint2.xy
>  <Location /domainint2.xy/>
>    ProxyPassReverse /
>    SetOutputFilter proxy-html
>    ProxyHTMLURLMap / /domainint2.xy/
>    ProxyHTMLURLMap /domainint2.xy /domainint2.xy
>    RequestHeader unset Accept-Encoding
>  </Location>
>  Options -Indexes MultiViews
>  DirectoryIndex index.php
>  DocumentRoot "/web/public/"
> </VirtualHost>
>
> This works realy fine, but:
> Now i hafe a script on http://domainINT2.xy/file.php in this file 
> there is a header redirect:
> HTTP/1.1 302
> Location: http://domainINT2.xy/file2.php
> Without the Proxy it will work, but if i call 
> https://domainEXT.xy/domainINT2.xy/file.php it makes also a redirect 
> to http://domainINT2.xy/file2.php and not to 
> https://domainEXT.xy/domainINT2.xy/file2.php
>
> Now my question:
> How can i say mod_proxy* also to rewrite this Location headers if in 
> it the domain name?
> (cos i can't modify the scripts of the domainINT* domain names.)
> I am shure this must work, but i don't know how?
>
> I hope you can help please, and sorry for my bad english!
>
> Greetings
> Michael
>
>
> ---------------------------------------------------------------------
> 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
>
>




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