Absolute url refs don't work with Apache ProxyPass
I have apache 2.0.43 compiled with mod_proxy configured with ProxyPass as follows: <IfModule mod_proxy.c> ProxyRequests On <Proxy :*> Order deny,allow Deny from all Allow from my.domain.com </Proxy> </IfModule> ProxyPass /zopesite http://my.domain.com:8080/zopesite ProxyPassReverse /zopesite http://my.domain.com:8080/zopesite Which gives me good results when I type http://my.domain.com/zopesite - apache will proxy the request for the Zserver on port 8080 to port 80. However, all of the links on the /zopesite have absolute urls i.e. if I mouse over an object on the site (file, whatever), it shows the following url: http://my.domain.com:8080/zopesite/adocument and therefore goes to port 8080. Is there anyway to config Zope to not use absolute but relative addressing? Is there something I'm not getting?
Asad Quraishi wrote:
ProxyRequests On
I don't think you need this in order to use ProxyPass
However, all of the links on the /zopesite have absolute urls
See the Zope Book 2.6 edition chapter on Virtual Hosting: http://www.zope.org/Documentation/Books/ZopeBook/2_6Edition/VirtualHosting.s... Cheers, Evan @ 4-am
Thanks. I tried it and it works using rewrite rules with one problem. Now Zope is sitting at my.domain.com/. This poses a problem since I need apache to serve html on other locations like my.domain.com/html. When I try this it hits the Zserver (port 8080) instead of the apache 'htdocs' directory. Regards, Asad Evan Simpson wrote:
Asad Quraishi wrote:
ProxyRequests On
I don't think you need this in order to use ProxyPass
However, all of the links on the /zopesite have absolute urls
See the Zope Book 2.6 edition chapter on Virtual Hosting:
http://www.zope.org/Documentation/Books/ZopeBook/2_6Edition/VirtualHosting.s...
Cheers,
Evan @ 4-am
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Reordered to make sense...
Evan Simpson wrote:
Asad Quraishi wrote:
ProxyRequests On
I don't think you need this in order to use ProxyPass
Worse, Asad, you have probably opened your server as an pseudo-anonymizer for every internet scumbag in the world. Set ProxyRequests to off (or delete that line) unless you really know what you are doing there. Asad Quraishi wrote:
Thanks. I tried it and it works using rewrite rules with one problem. Now Zope is sitting at my.domain.com/. This poses a problem since I need apache to serve html on other locations like my.domain.com/html. When I try this it hits the Zserver (port 8080) instead of the apache 'htdocs' directory.
There's the modifier [L], IIRC, for RewriteRule, which tells apache to stop rewriting at the point. So, just insert something like RewriteRule ^/html/ - [L] which tells apache to do nothing (and stop rewriting) if this rule matches. Please refer to the apache mod_rewrite docs for more info about tht. HTH, oliver
I can understand why you'd think that. You probably missed my first posting where I detailed a portion of the httpd.conf file: <IfModule mod_proxy.c> ProxyRequests On <Proxy :*> Order deny,allow Deny from all Allow from my.domain.com </Proxy> </IfModule> Better? - Asad Oliver Bleutgen wrote:
Reordered to make sense...
Evan Simpson wrote:
Asad Quraishi wrote:
ProxyRequests On
I don't think you need this in order to use ProxyPass
Worse, Asad, you have probably opened your server as an pseudo-anonymizer for every internet scumbag in the world. Set ProxyRequests to off (or delete that line) unless you really know what you are doing there.
Asad Quraishi wrote:
Thanks. I tried it and it works using rewrite rules with one problem. Now Zope is sitting at my.domain.com/. This poses a problem since I need apache to serve html on other locations like my.domain.com/html. When I try this it hits the Zserver (port 8080) instead of the apache 'htdocs' directory.
There's the modifier [L], IIRC, for RewriteRule, which tells apache to stop rewriting at the point. So, just insert something like
RewriteRule ^/html/ - [L]
which tells apache to do nothing (and stop rewriting) if this rule matches.
Please refer to the apache mod_rewrite docs for more info about tht.
HTH, oliver
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Asad Quraishi wrote:
I can understand why you'd think that. You probably missed my first posting where I detailed a portion of the httpd.conf file:
<IfModule mod_proxy.c> ProxyRequests On
<Proxy :*> Order deny,allow Deny from all Allow from my.domain.com </Proxy>
</IfModule>
Better?
;) Sorry, I saw that, but at the same time I was studying log files of a testing server which is exposed to the net on port 8080 and saw that we nearly got 50 hits from people testing for open proxies, per day, out of nowhere. So that "ProxyRequests On" triggered some urge to react fast. Seriously, I don't think you need any of that stuff you quoted above, because as Evan said, rewriting with the [P] modifier will still work and probably be faster (no lookups/testing for my.domain.com). I hope at least the other stuff I wrote was helpful. cheers, oliver
Thanks for the clarification ;-) - I appreciate the input and direction. To tell the truth (you got me!) I didn't want to get into the mod-rewrite doc - it's not the easiest to understand. But it looks like I should. I had already turned the proxy off once I saw that rewrite was a more effective tool so no worries... Regards, Asad Oliver Bleutgen wrote:
Asad Quraishi wrote:
I can understand why you'd think that. You probably missed my first posting where I detailed a portion of the httpd.conf file:
<IfModule mod_proxy.c> ProxyRequests On
<Proxy :*> Order deny,allow Deny from all Allow from my.domain.com </Proxy>
</IfModule>
Better?
;) Sorry, I saw that, but at the same time I was studying log files of a testing server which is exposed to the net on port 8080 and saw that we nearly got 50 hits from people testing for open proxies, per day, out of nowhere. So that "ProxyRequests On" triggered some urge to react fast. Seriously, I don't think you need any of that stuff you quoted above, because as Evan said, rewriting with the [P] modifier will still work and probably be faster (no lookups/testing for my.domain.com).
I hope at least the other stuff I wrote was helpful.
cheers, oliver
participants (3)
-
Asad Quraishi -
Evan Simpson -
Oliver Bleutgen