Hi, I'm trying to write a SiteAccess Rule to do some simple virtual hosting helping. Basically, I'd like to have access from http://www.mydomain.com (which is virtually hosted...) and from http://zope-host.nipltd.com/mydomain (the actual Zope host) and have all the management views, absolute_url()'s, etc working properly. If you just drop a SiteRoot in /mydomain then everything works fine through http://www.mydomain.com but http://zope-host.nipltd.com/mydomain/manage just jumps to http://zope-host.nipltd.com/manage. So I'd like to write my own Access Rule to do this. Now, the documentation for SiteAccess mentions a few methods of the REQUEST object that I can't find documentation for. I was wondering where I could find complete documentation for the REQUEST object, or how I can find out what its data and method attributes are? cheers, Chris
On Fri, 10 Mar 2000, Chris Withers wrote:
If you just drop a SiteRoot in /mydomain then everything works fine through http://www.mydomain.com but http://zope-host.nipltd.com/mydomain/manage just jumps to http://zope-host.nipltd.com/manage. So I'd like to write my own Access Rule to do this.
You don't need AccessRule for this - just path correct SiteRootBASE and SiteRootPATH environment variables to SiteRoot. Define it differently on every server, that's all. Oleg. ---- Oleg Broytmann Foundation for Effective Policies phd@phd.russ.ru Programmers don't die, they just GOSUB without RETURN.
Hmmm, Not sure I get you, and I'm not sure my explanation was clear... ;-) I'm only dealing with one server, which hosts several sites. Each site is in its own directory off Zope's root. eg: http://zope-host.nipltd.com/mydomain Each of these sites has its own domain name, which is virtually hosted using Apache as a front end into Zope. eg: www.mydomain.com --> http://zope-host.nipltd.com/mydomain Now, we typically maintain the sites with: http://zope-host.nipltd.com/manage and navigate through the links from there. However, site owners may maintain the site with, for example: http://www.mydomain.com/manage. Also, currently, wherever there's an absolute_url() or the like, such as in the management screens or in Squishdot sites, links are generated as follows when accessing through www.mydomain.com: eg: http://www.mydomain.com/mydomain/manage If you follow these links, they work through the magic of aquisition but, through following several such links, you can end up with rediculous URLS. eg: http://www.mydomain.com/mydomain/mydomain/mydomain/mydomain/manage I think SiteAccess's Site Root's are designed to sort this out. You drop a Site Root with a path of / into the /mydomain folder. Unfortunately, this site root also affects access through http://zope-host.nipltd.com/manage and so if you try and follow the link to http://zope-host.nipltd.com/mydomain/manage_workspace you in effect get redirected to http://zope-host.nipltd.com/manage_workspace 'cos the Site Root strips out the /mydomain. Also, if you go to http://zope-host.nipltd.com/mydomain/, all the links are broken for the same reason. Which is why I want to use an Access Rule instead and make it a little cleverer. Which is why I'm trying to find out what methods/variables there are in the REQUEST object, which doesn't appear to be documented very well ;-) cheers, Chris Oleg Broytmann wrote:
On Fri, 10 Mar 2000, Chris Withers wrote:
If you just drop a SiteRoot in /mydomain then everything works fine through http://www.mydomain.com but http://zope-host.nipltd.com/mydomain/manage just jumps to http://zope-host.nipltd.com/manage. So I'd like to write my own Access Rule to do this.
You don't need AccessRule for this - just path correct SiteRootBASE and SiteRootPATH environment variables to SiteRoot. Define it differently on every server, that's all.
Oleg. ---- Oleg Broytmann Foundation for Effective Policies phd@phd.russ.ru Programmers don't die, they just GOSUB without RETURN.
On Fri, 10 Mar 2000, Chris Withers wrote:
I think SiteAccess's Site Root's are designed to sort this out. You drop a Site Root with a path of / into the /mydomain folder.
No, make path empty!
Unfortunately, this site root also affects access through http://zope-host.nipltd.com/manage and so if you try and follow the link to http://zope-host.nipltd.com/mydomain/manage_workspace you in effect get redirected to http://zope-host.nipltd.com/manage_workspace 'cos the Site Root strips out the /mydomain.
Do not pass any SiteRoot* variables in this domain and pass both in www.mydomain.com. SiteRootBASE => http://www.mydomain.com SiteRootPATH => / That should do all tricks you want. Oleg. ---- Oleg Broytmann Foundation for Effective Policies phd@phd.russ.ru Programmers don't die, they just GOSUB without RETURN.
Unfortunately, this site root also affects access through http://zope-host.nipltd.com/manage and so if you try and follow the link to http://zope-host.nipltd.com/mydomain/manage_workspace you in effect get redirected to http://zope-host.nipltd.com/manage_workspace 'cos the Site Root strips out the /mydomain.
Do not pass any SiteRoot* variables in this domain and pass both in www.mydomain.com.
SiteRootBASE => http://www.mydomain.com SiteRootPATH => /
Okay, I think I'm starting to understand more, btu I'm still not quite there yet ;-) When you say 'pass any siteroot variables' what do you mean? Do you mean pass them from Apache? Do you mean set them as properties somewhere? or something else.... cheers, Chris
On Fri, 10 Mar 2000, Chris Withers wrote:
Do not pass any SiteRoot* variables in this domain and pass both in www.mydomain.com.
SiteRootBASE => http://www.mydomain.com SiteRootPATH => /
When you say 'pass any siteroot variables' what do you mean?
Do you mean pass them from Apache?
Exactly this. How do you access Zope from Apache? Proxy, FastCGI or PCGI? They all have different methods to pass vars (and I afraid proxy doesn't have such way).
Do you mean set them as properties somewhere?
Properties will be used for all domains, that why I said set path property empty in SiteRoot. Oleg. ---- Oleg Broytmann Foundation for Effective Policies phd@phd.russ.ru Programmers don't die, they just GOSUB without RETURN.
Exactly this. How do you access Zope from Apache? Proxy, FastCGI or PCGI? They all have different methods to pass vars (and I afraid proxy doesn't have such way).
Okay, we use proxy :( . Also, the URLs are rewritten by Apache so that all the relative links don't go to http://zope-host.nipltd.com/mydomain/*whatever* as opposed to http://www.mydomain.com/*whatever* What I was thinking is to write a Site Access rule as follows: If the host name is zope-host.nipltd.com: do nothing else <dtml-call "REQUEST.setURL(path='/')"> Maybe storing zope-host.nipltd.com in a property of the root level folder too. My only problem is finding out what the host name is. Will REQUEST.environ.HTTP_HOST be set by the time an Access Rule is called? Chris
On Fri, 10 Mar 2000, Chris Withers wrote:
Will REQUEST.environ.HTTP_HOST be set by the time an Access Rule is called?
I am afraid it'll be set to incorrect host by proxy... Oleg. ---- Oleg Broytmann Foundation for Effective Policies phd@phd.russ.ru Programmers don't die, they just GOSUB without RETURN.
----- Original Message ----- From: Chris Withers <chrisw@nipltd.com>
Okay, we use proxy :( . Also, the URLs are rewritten by Apache so that all the relative links don't go to http://zope-host.nipltd.com/mydomain/*whatever* as opposed to http://www.mydomain.com/*whatever*
What I was thinking is to write a Site Access rule as follows:
If the host name is zope-host.nipltd.com: do nothing else <dtml-call "REQUEST.setURL(path='/')">
One possible approach here is to have your proxy add a magic path element to the path, sending http://www.mydomain.com/PATH to http://zope-host.nipltd.com/PROXIED/mydomain/PATH. Then have an Access Rule which says: If "REQUEST.path and REQUEST.path[-1]=='PROXIED'" then "REQUEST.path.pop()" and "REQUEST.setURL(path='/')". There doesn't have to be a real object called PROXIED, it's just a flag to be recognized and discarded by the Access Rule. Cheers, Evan @ 4-am & digicool
participants (3)
-
Chris Withers -
Evan Simpson -
Oleg Broytmann