|
|
|
|
|
|
| Author |
Message |
David Filion *nix forums beginner
Joined: 04 Jul 2006
Posts: 11
|
Posted: Tue Jul 18, 2006 1:43 pm Post subject:
mod_proxy question
|
|
|
Hi,
How can I turn ProxyPreserveHost on for for some RewriteRules then off
again for some ProxyPass lines in the same vhost?
Putting ProxyPreserveHost On before the Rewrites works as expected
(turns it on), but when I put the ProxyPreserveHost Off command before
the ProxyPass lines, it has no effect, ProxyPreserveHost appears to
still be on. It's as if the directive is ignored. Is this the correct
behaviour?
The docs are not real clear on this point and there are no entries in
bugzilla.
Thanks!
David f.
---------------------------------------------------------------------
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 |
|
| Back to top |
|
 |
David Filion *nix forums beginner
Joined: 04 Jul 2006
Posts: 11
|
Posted: Tue Jul 18, 2006 1:55 pm Post subject:
Re: mod_proxy question
|
|
|
David f. wrote:
| Quote: | Hi,
How can I turn ProxyPreserveHost on for for some RewriteRules then off
again for some ProxyPass lines in the same vhost?
Putting ProxyPreserveHost On before the Rewrites works as expected
(turns it on), but when I put the ProxyPreserveHost Off command before
the ProxyPass lines, it has no effect, ProxyPreserveHost appears to
still be on. It's as if the directive is ignored. Is this the
correct behaviour?
The docs are not real clear on this point and there are no entries in
bugzilla.
Thanks!
David f.
Hit send too soon, here are the details: |
Apache 2.2.2
<VirtualHost 192.168.107.37>
ServerName www.domain.com
DocumentRoot /data/domain
<IfDefine REVERSE_PROXY>
ProxyPreserveHost On
RewriteCond %{LA-U:SCRIPT_FILENAME} \.spy$ [NC]
RewriteRule .* http://192.168.107.37:8080%{REQUEST_URI} [P,L]
ProxyPassReverse / http://192.168.107.37:8080/
# ProxyPreserveHost Off <--- Uncommenting this causes apache to
always redirect back to domain.com!
</IfDefine>
<IfModule mod_proxy.c>
ProxyRequests Off
ProxyPass /fr/forum/ http://forums_fr.domain.com/
ProxyPassReverse /fr/forum/ http://forums_fr.domain.com/
ProxyPass /en/forum/ http://forums_en.domain.com/
ProxyPassReverse /en/forum/ http://forums_en.domain.com/
</IfModule>
</VirtualHost>
forums_en.domain.com and forums_fr are hosts in a private IP space that
is only accessible from the web server. They are defined in the
webserver's hosts file.
---------------------------------------------------------------------
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 |
|
| Back to top |
|
 |
David Filion *nix forums beginner
Joined: 04 Jul 2006
Posts: 11
|
Posted: Tue Jul 18, 2006 2:03 pm Post subject:
Re: mod_proxy question
|
|
|
David f. wrote:
| Quote: | David f. wrote:
Hi,
How can I turn ProxyPreserveHost on for for some RewriteRules then
off again for some ProxyPass lines in the same vhost?
Putting ProxyPreserveHost On before the Rewrites works as expected
(turns it on), but when I put the ProxyPreserveHost Off command
before the ProxyPass lines, it has no effect, ProxyPreserveHost
appears to still be on. It's as if the directive is ignored. Is
this the correct behaviour?
The docs are not real clear on this point and there are no entries in
bugzilla.
Thanks!
David f.
Hit send too soon, here are the details:
Apache 2.2.2
VirtualHost 192.168.107.37
ServerName www.domain.com
DocumentRoot /data/domain
IfDefine REVERSE_PROXY
ProxyPreserveHost On
RewriteCond %{LA-U:SCRIPT_FILENAME} \.spy$ [NC]
RewriteRule .* http://192.168.107.37:8080%{REQUEST_URI} [P,L]
ProxyPassReverse / http://192.168.107.37:8080/
# ProxyPreserveHost Off <--- Uncommenting this causes apache
to always redirect back to domain.com!
/IfDefine
IfModule mod_proxy.c> ProxyRequests Off
ProxyPass /fr/forum/ http://forums_fr.domain.com/
ProxyPassReverse /fr/forum/ http://forums_fr.domain.com/
ProxyPass /en/forum/ http://forums_en.domain.com/
ProxyPassReverse /en/forum/ http://forums_en.domain.com/
/IfModule
/VirtualHost
forums_en.domain.com and forums_fr are hosts in a private IP space
that is only accessible from the web server. They are defined in the
webserver's hosts file.
---------------------------------------------------------------------
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
|
More details. Here are the headers I see:
http://www.domain.com/en/forum/
GET /en/forum/ HTTP/1.1
Host: www.domain.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.4)
Gecko/20060508 Firefox/1.5.0.4
Accept:
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://www.domain.com/en/
HTTP/1.x 301 Moved Permanently
Date: Tue, 18 Jul 2006 13:59:46 GMT
Server: Apache-AdvancedExtranetServer/1.3.31 (Mandrakelinux/7.1.101mdk)
PHP/4.3.8 mod_ssl/2.8.19 OpenSSL/0.9.7d
Location: http://www.domain.com/
Content-Type: text/html; charset=iso-8859-1
Keep-Alive: timeout=2, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
---------------------------------------------------------------------
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 |
|
| Back to top |
|
 |
Neil A. Hillard *nix forums addict
Joined: 09 Mar 2005
Posts: 77
|
Posted: Wed Jul 19, 2006 10:55 am Post subject:
Re: mod_proxy question
|
|
|
** Resent as the original never made it due to my new e-mail address **
Hi,
David f. wrote:
| Quote: | David f. wrote:
Hi,
How can I turn ProxyPreserveHost on for for some RewriteRules then off
again for some ProxyPass lines in the same vhost?
Putting ProxyPreserveHost On before the Rewrites works as expected
(turns it on), but when I put the ProxyPreserveHost Off command before
the ProxyPass lines, it has no effect, ProxyPreserveHost appears to
still be on. It's as if the directive is ignored. Is this the
correct behaviour?
The docs are not real clear on this point and there are no entries in
bugzilla.
Thanks!
David f.
Hit send too soon, here are the details:
Apache 2.2.2
VirtualHost 192.168.107.37
ServerName www.domain.com
DocumentRoot /data/domain
IfDefine REVERSE_PROXY
ProxyPreserveHost On
RewriteCond %{LA-U:SCRIPT_FILENAME} \.spy$ [NC]
RewriteRule .* http://192.168.107.37:8080%{REQUEST_URI} [P,L]
ProxyPassReverse / http://192.168.107.37:8080/
# ProxyPreserveHost Off <--- Uncommenting this causes apache to
always redirect back to domain.com!
/IfDefine
IfModule mod_proxy.c> ProxyRequests Off
ProxyPass /fr/forum/ http://forums_fr.domain.com/
ProxyPassReverse /fr/forum/ http://forums_fr.domain.com/
ProxyPass /en/forum/ http://forums_en.domain.com/
ProxyPassReverse /en/forum/ http://forums_en.domain.com/
/IfModule
/VirtualHost
forums_en.domain.com and forums_fr are hosts in a private IP space that
is only accessible from the web server. They are defined in the
webserver's hosts file.
|
You can't turn it on and off within a virtual host - it's either on or
off, end of story.
I have encountered this and worked around it by using a second virtual
server which does preserve the host name, called by the first which
doesn't but it's not pretty and I wouldn't recommend it unless strictly
necessary.
It would be nice to be able to explicitly set the Host: header but that
appears to be overwritten when the request is proxied.
HTH,
Neil.
--
Neil Hillard neil.hillard@agustawestland.com
Westland Helicopters Ltd. http://www.whl.co.uk/
Disclaimer: This message does not necessarily reflect the
views of Westland Helicopters Ltd.
---------------------------------------------------------------------
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 |
|
| Back to top |
|
 |
David Filion *nix forums beginner
Joined: 04 Jul 2006
Posts: 11
|
Posted: Wed Jul 19, 2006 12:37 pm Post subject:
Re: mod_proxy question
|
|
|
Neil A. Hillard wrote:
| Quote: | ** Resent as the original never made it due to my new e-mail address **
Hi,
David f. wrote:
David f. wrote:
Hi,
How can I turn ProxyPreserveHost on for for some RewriteRules then off
again for some ProxyPass lines in the same vhost?
Putting ProxyPreserveHost On before the Rewrites works as expected
(turns it on), but when I put the ProxyPreserveHost Off command before
the ProxyPass lines, it has no effect, ProxyPreserveHost appears to
still be on. It's as if the directive is ignored. Is this the
correct behaviour?
The docs are not real clear on this point and there are no entries in
bugzilla.
Thanks!
David f.
Hit send too soon, here are the details:
Apache 2.2.2
VirtualHost 192.168.107.37
ServerName www.domain.com
DocumentRoot /data/domain
IfDefine REVERSE_PROXY
ProxyPreserveHost On
RewriteCond %{LA-U:SCRIPT_FILENAME} \.spy$ [NC]
RewriteRule .* http://192.168.107.37:8080%{REQUEST_URI} [P,L]
ProxyPassReverse / http://192.168.107.37:8080/
# ProxyPreserveHost Off <--- Uncommenting this causes apache to
always redirect back to domain.com!
/IfDefine
IfModule mod_proxy.c> ProxyRequests Off
ProxyPass /fr/forum/ http://forums_fr.domain.com/
ProxyPassReverse /fr/forum/ http://forums_fr.domain.com/
ProxyPass /en/forum/ http://forums_en.domain.com/
ProxyPassReverse /en/forum/ http://forums_en.domain.com/
/IfModule
/VirtualHost
forums_en.domain.com and forums_fr are hosts in a private IP space that
is only accessible from the web server. They are defined in the
webserver's hosts file.
You can't turn it on and off within a virtual host - it's either on or
off, end of story.
I have encountered this and worked around it by using a second virtual
server which does preserve the host name, called by the first which
doesn't but it's not pretty and I wouldn't recommend it unless strictly
necessary.
It would be nice to be able to explicitly set the Host: header but that
appears to be overwritten when the request is proxied.
HTH,
Neil.
|
Thanks for the info. That is something that might want to be added to
the docs for the sake of
clarity.
We ended up solving the problem by adding domain.com as a server alias
to the proxied server's
virtual host. Again maybe not the cleanest, but it works.
David
---------------------------------------------------------------------
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 |
|
| Back to top |
|
 |
Google
|
|
| Back to top |
|
 |
|
|
The time now is Sat Nov 22, 2008 12:43 am | All times are GMT
|
|
Refinance | Ringtones | Loans | Herbal Supplements | Mortgages
|
|
Copyright © 2004-2005 DeniX Solutions SRL
|
|
|
|
Other DeniX Solutions sites:
Unix/Linux blog |
electronics forum |
medicine forum |
science forum |
|
|
Privacy Policy
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|