Re: [Zope] apache rewrite rules redux
(Thu, May 25, 2006 at 06:35:59PM -0700) David Bear wrote/schrieb/egrapse: humans can grasp? beginning to wonder about that. Please keep replies on the list, thanks. Okay. I have reran the witch and have the following rules: # see http://betabug.ch/zope/witch RewriteRule ^/z2$ \ ...snip... All is well with standard http connections. I still get a 404 when attempt https connections. There is NO name based virtual hosting here. There is a single host in the apache config file. And there is only 1 ip address that apache listens on. Are there any other keys to the rewrite world that I should look at? These rules look reasonable, I don't see why they shouldn't work. I believe your httpd.conf has some problem. Specifically (and as I think suggested by others) I believe that rule is somewhere where it doesn't get executed. I suggest to comment out the http rules for a moment, turn on RewriteLog (e.g. pointing it to /tmp/rewritelog or something for the moment) and then look what's happening. I expect that you don't see any output... but of course I might be wrong. Please note that in my oppinion this is a problem of apache configuration, not of Zope. Regards, Sascha ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] apache rewrite rules redux
(Wed, May 24, 2006 at 12:00:09PM -0400) [EMAIL PROTECTED] wrote/schrieb/egrapse: From: David Bear [EMAIL PROTECTED] # see http://betabug.ch/zope/witch RewriteRule ^/z2$ http://127.0.0.1:9080/VirtualHostBase/\ https/%SERVER_NAME}:80/VirtualHostRoot/_vh_z2/ [L,P] RewriteRule ^/z2/(.*) http://127.0.0.1:9080/VirtualHostBase/\ https/%{SERVER_NAME}:80/VirtualHostRoot/_vh_z2/$1 [L,P] ^^ Just telling the witch to use https isn't enough, you have to tell it the port too (usually 443). This isn't the most obvious thing from th form, but it should be a cluee that the port doesn't change when you select https. I also found the following rule from scanning through zope-list postings, to force any logon authentication requests to go over https. However, since the above rules fail, the following does nothing. RewriteRule ^/login_form(.*) https://%{SERVER_NAME}/login_form$1 [NE,L] This is a redirect and once your https-rewriterule works, it should too. From: Chris Withers [EMAIL PROTECTED] In both cases, I see no need for two rules, just the one should suffice: RewriteRule ^/z2(.*) http://127.0.0.1:9080/VirtualHostBase/\ http/%{SERVER_NAME}:80/VirtualHostRoot/_vh_z2$1 [L,P] Yes, that will work too, unless of course you happen to have a URL that goes something like http://www.host.tld/z2thisisnotzope/index.html and apache will happily rewrite it for you, resulting in a 404. The two rules of the witch could likely be rewritten to one, but two rules cover the two possibilities easy in a form that humans can grasp: Either the URL ends there, or else it has a slash and then as much as there is. Regards, Sascha ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] apache rewrite rules redux
I went back to betabug and reran the rule generator. I was able to use the rules for http connections... but not for https connection. I thought the two rules might be conflicting some how so I commented out the rules for http connections and the https connections still don't work, ie I still get the 404 error. Here is what I have now. # see http://betabug.ch/zope/witch # RewriteRule ^/z2$ \ # http://127.0.0.1:9080/VirtualHostBase/\ # http/%{SERVER_NAME}:80/VirtualHostRoot/_vh_z2/ [L,P] # RewriteRule ^/z2/(.*) \ # http://127.0.0.1:9080/VirtualHostBase/\ # http/%{SERVER_NAME}:80/VirtualHostRoot/_vh_z2/$1 [L,P] # RewriteRule ^/z2$ \ http://127.0.0.1:9080/VirtualHostBase/\ https/%{SERVER_NAME}:443/VirtualHostRoot/_vh_z2/ [L,P] RewriteRule ^/z2/(.*) \ http://127.0.0.1:9080/VirtualHostBase/\ https/%{SERVER_NAME}:443/VirtualHostRoot/_vh_z2/$1 [L,P] I can uncomment the http rules and they work. But whats the point of using apache if I can get it to do https? (aside from legacy files and other apps that depend on it...) There must be a better way.. On 5/25/06, Sascha Welter [EMAIL PROTECTED] wrote: (Wed, May 24, 2006 at 12:00:09PM -0400) [EMAIL PROTECTED] wrote/schrieb/egrapse: From: David Bear [EMAIL PROTECTED] # see http://betabug.ch/zope/witch RewriteRule ^/z2$ http://127.0.0.1:9080/VirtualHostBase/\ https/%SERVER_NAME}:80/VirtualHostRoot/_vh_z2/ [L,P] RewriteRule ^/z2/(.*) http://127.0.0.1:9080/VirtualHostBase/\ https/%{SERVER_NAME}:80/VirtualHostRoot/_vh_z2/$1 [L,P] ^^Just telling the witch to use https isn't enough, you have to tell itthe port too (usually 443).This isn't the most obvious thing from th form, but it should be a clueethat the port doesn't change when you select https. I also found the following rule from scanning through zope-list postings, to force any logon authentication requests to go over https. However, since the above rules fail, the following does nothing. RewriteRule ^/login_form(.*) https://%{SERVER_NAME}/login_form$1 [NE,L]This is a redirect and once your https-rewriterule works, it should too. From: Chris Withers [EMAIL PROTECTED] In both cases, I see no need for two rules, just the one should suffice: RewriteRule ^/z2(.*) http://127.0.0.1:9080/VirtualHostBase/\ http/%{SERVER_NAME}:80/VirtualHostRoot/_vh_z2$1 [L,P]Yes, that will work too, unless of course you happen to have a URL thatgoes something like http://www.host.tld/z2thisisnotzope/index.html and apachewill happily rewrite it for you, resulting in a 404.The two rules of the witch could likely be rewritten to one, but tworules cover the two possibilities easy in a form that humans can grasp: Either the URL ends there, or else it has a slash and then as much asthere is.Regards,Sascha___Zope maillist- Zope@zope.orghttp://mail.zope.org/mailman/listinfo/zope** No cross posts or HTML encoding!**(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )-- David BearWhat's the difference between private knowledge and public knowledge? ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] apache rewrite rules redux
Hi David, I'm suffering from a coffee underflow error, so am not 100% (yet!), but... David Bear wrote: RewriteRule ^/z2$ http://127.0.0.1:9080/VirtualHostBase/\ https/%SERVER_NAME}:80/VirtualHostRoot/_vh_z2/ [L,P] RewriteRule ^/z2/(.*) http://127.0.0.1:9080/VirtualHostBase/\ https/%{SERVER_NAME}:80/VirtualHostRoot/_vh_z2/$1 [L,P] RewriteRule ^/z2$ http://127.0.0.1:9080/VirtualHostBase/\ http/%SERVER_NAME}:80/VirtualHostRoot/_vh_z2/ [L,P] RewriteRule ^/z2/(.*) http://127.0.0.1:9080/VirtualHostBase/\ http/%{SERVER_NAME}:80/VirtualHostRoot/_vh_z2/$1 [L,P] The rules listed above only work to serve content from http://servername/z2 .. They refuse to work for https://servername/z2 (that generates a not found error) Any other advice on make both urls work? Yes! Your rewrite rules are all rewriting to port 80, but for SSL you need port 443, so you should have something like: - RewriteRule ^/z2$ http://127.0.0.1:9080/VirtualHostBase/\ https/%SERVER_NAME}:443/VirtualHostRoot/_vh_z2/ [L,P] ^^^ ...for the SSL versions. HTH! -- Regards, PhilK 'I must create my own system or be enslaved by another man's.' - William Blake ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] apache rewrite rules redux
David Bear wrote: # see http://betabug.ch/zope/witch RewriteRule ^/z2$ http://127.0.0.1:9080/VirtualHostBase/\ https/%SERVER_NAME}:80/VirtualHostRoot/_vh_z2/ [L,P] RewriteRule ^/z2/(.*) http://127.0.0.1:9080/VirtualHostBase/\ https/%{SERVER_NAME}:80/VirtualHostRoot/_vh_z2/$1 [L,P] These rules need to appear in the virtual host that's listening on port 443, my suspicion is that it's being applied to the virtual host listening on port 80, and so doing nothing. RewriteRule ^/z2$ http://127.0.0.1:9080/VirtualHostBase/\ http/%SERVER_NAME}:80/VirtualHostRoot/_vh_z2/ [L,P] RewriteRule ^/z2/(.*) http://127.0.0.1:9080/VirtualHostBase/\ http/%{SERVER_NAME}:80/VirtualHostRoot/_vh_z2/$1 [L,P] In both cases, I see no need for two rules, just the one should suffice: RewriteRule ^/z2(.*) http://127.0.0.1:9080/VirtualHostBase/\ http/%{SERVER_NAME}:80/VirtualHostRoot/_vh_z2$1 [L,P] cheers, Chris -- Simplistix - Content Management, Zope Python Consulting - http://www.simplistix.co.uk ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )