Re: [Zope] apache rewrite rules redux

2006-05-23 Thread Philip Kilner
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 )


[Zope] apache rewrite rules redux

2006-05-23 Thread David Bear
the more I try to get this to work, the less I understand. Sorry to bug these groups again, but I still need a little help.

I would like my zope content (and plone) available to both http adn
https urls. I went to betabug/zope/witch and was able to generate the
following rule sets.

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

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?

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]
-- 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] RESPONSE.redirect not working

2006-05-23 Thread Andrew Hedges
Actually, that is exactly what is happening.  It's the current URL  
with the contents of login_html rendered.  I changed it to the  
following and it worked:






Thanks again for your help!
-Andrew

On May 23, 2006, at  5/23/2006 5:02 PMMDT, Jo Meder wrote:


Am 24.05.2006, 00:57 Uhr
schriebte Andrew Hedges <[EMAIL PROTECTED]>:







Are you sure you're seeing the redirect there and not just the login
page rendered for the address you were originally accessing?

Just wondering...

Jo.


___
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] RESPONSE.redirect not working

2006-05-23 Thread Andrew Hedges

Jo,

THANK YOU!  This worked (with a slight change to the dtml-return):





I *thought* I had seen redirect work as I had had it before, but  
maybe I misunderstood what was happening.  In any case, many thanks!


-Andrew

On May 23, 2006, at  5/23/2006 4:46 PMMDT, Jo Meder wrote:


Hi there!

Given your code in pyCheckSession try the following (not tested):


  


and change pyCheckSession to:


if url <> '':
"If we have need to, bump the user out"
RESPONSE.redirect(url)

return 0

  else:

return 1

The call to "redirect" doesn't magically stop processing of everything
else you programmed.


___
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] RESPONSE.redirect not working

2006-05-23 Thread Jo Meder
Am 24.05.2006, 00:24 Uhr
schriebte Andrew Hedges <[EMAIL PROTECTED]>:

> I'm at my wit's end.  Any help is appreciated.  Yes, I have worn  
> Google out trying to figure this out.
> 
> In my (yeah, yeah, I know) DTML method, I have structured things like  
> so:
> 
> <-- a Python script that checks

Hi there!

Given your code in pyCheckSession try the following (not tested):


  


and change pyCheckSession to:

> if url <> '':
>   "If we have need to, bump the user out"
>   RESPONSE.redirect(url)
return 0

  else:

return 1

The call to "redirect" doesn't magically stop processing of everything
else you programmed. 


Hope it helps,

Jo.


-- 
internetmanufaktur jo- Berlin, Germany
  |||meder--- fon: ++49-30-44 04 27 82
http://www.meder.de/  fax: ++49-30-44 04 30 95
Kollwitzstr. 66  mob: ++49-170- 2 98 89 97
10435 Berlin ---http://www.meder.de/keys/jo-pubkey.txt
___
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] RESPONSE.redirect not working

2006-05-23 Thread Jens Vagelpohl

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


On 23 May 2006, at 23:24, Andrew Hedges wrote:

Here are the contents of the response object:

   HTTP/1.1 302 Moved Temporarily
   Server: Zope/(Zope 2.9.2-, python 2.4.2, darwin) ZServer/1.1
   Date: Tue, 23 May 2006 22:05:51 GMT
   Content-Length: 0
   Location: /www/nmact/MVP/website/login_html


Stab in the dark: I've only ever seen *full* URLs in the Location  
header, not just paths. Maybe it makes a difference if you redirect  
to a full URL, not just a path?


jens

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (Darwin)

iD8DBQFEc4/JRAx5nvEhZLIRApyzAKC8GYj4G1gLIftJWQDKJ4LsjkOIOACdG+uy
/Lw+Zlb8kBhTPDpdC8uqIqk=
=n+mN
-END PGP SIGNATURE-
___
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 )


[Zope] RESPONSE.redirect not working

2006-05-23 Thread Andrew Hedges
I'm at my wit's end.  Any help is appreciated.  Yes, I have worn  
Google out trying to figure this out.


In my (yeah, yeah, I know) DTML method, I have structured things like  
so:


<-- a Python script that checks  
whether the user is allowed to see the page

<-- header include
   ...
   Sundry HTML/DTML
   ...

I am running Zope 2.9.2 and Python 2.4.2 on Mac OS X 10.4.6.  I have  
the stock session manager objects installed (Transient Object  
Container, Session Data Manager, and Browser Id Manager).


When I am not logged in and I go to an unauthorized page, the  
response location appears to get set as desired, but the redirect  
does not happen.  Instead, the page from the original URL still  
renders (not very secure, I'd say).


The URL I hit was:

   http://localhost:8080/www/nmact/MVP/website/mymvp_html

Here are the relevant bits from pyCheckSession:

request = container.REQUEST
RESPONSE = request.RESPONSE

session = request.SESSION
url = ''

if len(session.keys()) == 0:
   "User is not logged in"
   url = '/www/nmact/MVP/website/login_html'

if url <> '':
"If we have need to, bump the user out"
RESPONSE.redirect(url)

Here are the contents of the response object:

   HTTP/1.1 302 Moved Temporarily
   Server: Zope/(Zope 2.9.2-, python 2.4.2, darwin) ZServer/1.1
   Date: Tue, 23 May 2006 22:05:51 GMT
   Content-Length: 0
   Location: /www/nmact/MVP/website/login_html

To reiterate, the response location appears to get set to login_html,  
but the content of mymvp_html still renders.  What am I doing wrong?


TIA,
-Andrew
-
[EMAIL PROTECTED] / http://clearwired.com
___
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 )