niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » Apps » Apache
mod_proxy question
Post new topic   Reply to topic Page 1 of 1 [5 Posts] View previous topic :: View next topic
Author Message
David Filion
*nix forums beginner


Joined: 04 Jul 2006
Posts: 11

PostPosted: Tue Jul 18, 2006 1:43 pm    Post subject: mod_proxy question Reply with 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.



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

PostPosted: Tue Jul 18, 2006 1:55 pm    Post subject: Re: mod_proxy question Reply with quote

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

PostPosted: Tue Jul 18, 2006 2:03 pm    Post subject: Re: mod_proxy question Reply with quote

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

PostPosted: Wed Jul 19, 2006 10:55 am    Post subject: Re: mod_proxy question Reply with quote

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

PostPosted: Wed Jul 19, 2006 12:37 pm    Post subject: Re: mod_proxy question Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [5 Posts] View previous topic :: View next topic
The time now is Sat Nov 22, 2008 12:43 am | All times are GMT
navigation Forum index » Apps » Apache
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts Newbie question: How to forward a domain to a mailbox? leei Postfix 0 Fri Aug 24, 2007 4:55 pm
No new posts configuration question for httpd Karl Wang Apache 1 Fri Jul 21, 2006 2:10 pm
No new posts nim problem/question Ron AIX 0 Fri Jul 21, 2006 1:57 pm
No new posts question for JAVA developer who r using postgres sql as b... deepak pal PostgreSQL 1 Fri Jul 21, 2006 9:00 am
No new posts Encryption Question dtuttle1@gmail.com Berkeley DB 2 Thu Jul 20, 2006 10:09 pm

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
[ Time: 0.2028s ][ Queries: 16 (0.0884s) ][ GZIP on - Debug on ]