You are not logged in Log in Join
You are here: Home » Members » 4AM Productions (Evan Simpson) » SiteAccess 2 » All about SiteAccess

Log in
Name

Password

 
 

Basics

SiteAccess started as a Product to enable Zope Virtual Hosting, then became more generalized. Virtual Hosting is the ability to publish sub-objects of a Zope hierarchy as though they were the root of their own site. For example, it allows 'http:/www.silly-walks.org/current' to publish the Zope object 'silly-walks/current' instead of just 'current'.

Usage

See:

What does SiteAccess do?

SiteAccess provides the ability to force ZPublisher to call objects of your choice as it enters any folder. With this capability, you can designate a method in the Zope root to examine the request parameters and alter or replace the URL.

If an Access Rule is broken, and is preventing normal access, it can be disabled by restarting Zope with environment variable SUPPRESS_ACCESSRULE set.

History

When I first needed virtual host support in Zope 2.x, SiteRoots were the simplest way I could think of to encapsulate virtual host root behavior. Access Rules were necessary if I wanted to redirect different host names to different folders without using Apache's virtual host support. Together, they worked for me, so I stopped there and released them as the SiteAccess Product.

Since I designed tools rather than a simple drop-in solution, people had to figure out how to best apply those tools, and several of them helpfully wrote HowTos. It has become painfully obvious over time, though, that Access Rules are more complicated and dangerous than many users are ready to deal with, and SiteRoots are too blunt a tool.

In particular, Access Rules and SiteRoots trigger whether you want them to or not, and I've had to tell many a panicked email correspondent how to disable one or the other (put _SUPPRESS_ACCESSRULE or _SUPPRESS_SITEROOT in the right place in your URL) because they were locked out of their Zope.

Just before SiteAccess was brought into the core, in Zope 2.3, I came up with the idea for Virtual Host Monsters. They are intended to be the drop-in solution that everyone always wanted. They are totally inert unless you use specially-rewritten URLs, so they can't lock you out of Zope. They don't require (or allow, yet) any sort of configuration. You simply take your existing Apache RewriteRule or ProxyPass directive and add a few path elements.

Here are some example Apache directives, before and after adapting them for use with a Virtual Host Monster:

# Simple HTTP front-ends
BEFORE: ProxyPass / http://localhost:8080/
- AFTER: ProxyPass / http://localhost:8080/VirtualHostBase/http/www.hostname.com:80/

BEFORE: RewriteRule ^/(.*) http://localhost:8080/$1 [P,L]
- AFTER: RewriteRule ^/(.*) http://localhost:8080/VirtualHostBase/http/www.hostname.com:80/$1 [P,L]

# Simple HTTPS front-ends
BEFORE: ProxyPass / http://localhost:8080/
- AFTER: ProxyPass / http://localhost:8080/VirtualHostBase/https/www.hostname.com:443/

BEFORE: RewriteRule ^/(.*) http://localhost:8080/$1 [P,L]
- AFTER: RewriteRule ^/(.*) http://localhost:8080/VirtualHostBase/https/www.hostname.com:443/$1 [P,L]

# Apache virtual host in a Zope sub-folder
BEFORE: ProxyPass / http://localhost:8080/host1
- AFTER: ProxyPass / http://localhost:8080/VirtualHostBase/http/www.hostname.com:80/host1/VirtualHostRoot

BEFORE: RewriteRule ^/(.*) http://localhost:8080/host1/$1 [P,L]
- AFTER: RewriteRule ^/(.*) http://localhost:8080/VirtualHostBase/http/www.hostname.com:80/host1/VirtualHostRoot/$1 [P,L]

# Entire Zope in an Apache sub-folder
BEFORE: ProxyPass /subZope http://localhost:8080/
- AFTER: ProxyPass /subZope http://localhost:8080/VirtualHostBase/http/www.hostname.com:80/VirtualHostRoot/_vh_subZope

BEFORE: RewriteRule ^/subZope(.*) http://localhost:8080$1 [P,L]
- AFTER: RewriteRule ^/subZope(.*) http://localhost:8080/VirtualHostBase/http/www.hostname.com:80/VirtualHostRoot/_vh_subZope$1 [P,L]