apache rewrite rules redux

classic Classic list List threaded Threaded
3 messages Options
David Bear-2 David Bear-2
Reply | Threaded
Open this post in threaded view
|

apache rewrite rules redux

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$ <a href="http://127.0.0.1:9080/VirtualHostBase/\">http://127.0.0.1:9080/VirtualHostBase/\
https/%SERVER_NAME}:80/VirtualHostRoot/_vh_z2/ [L,P]

RewriteRule ^/z2/(.*) <a href="http://127.0.0.1:9080/VirtualHostBase/\">http://127.0.0.1:9080/VirtualHostBase/\
https/%{SERVER_NAME}:80/VirtualHostRoot/_vh_z2/$1 [L,P]

RewriteRule ^/z2$ <a href="http://127.0.0.1:9080/VirtualHostBase/\">http://127.0.0.1:9080/VirtualHostBase/\
http/%SERVER_NAME}:80/VirtualHostRoot/_vh_z2/ [L,P]

RewriteRule ^/z2/(.*) <a href="http://127.0.0.1:9080/VirtualHostBase/\">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 Bear
What's the difference between private knowledge and public knowledge?
Philip Kilner Philip Kilner
Reply | Threaded
Open this post in threaded view
|

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


-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
Plone-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users
Chris Withers Chris Withers
Reply | Threaded
Open this post in threaded view
|

Re: [Zope] apache rewrite rules redux

In reply to this post by David Bear-2
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



-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
Plone-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users