From: Eli Naeher Date: 04:15 on 14 Jul 2006 Subject: Transportation of a URI Across Port Boundaries for Immoral Purposes I found this nice little web application I use for keeping track of random bits of data. It's nothing very fancy but it's clean, simple, has a nice interface, etc. For some reason, however, its otherwise-sensible author decided to implement it under Zope, which needed to be installed to get it going. There were a few eccentricities involved in doing so (why is the port on which to listen specified as the combination of a base and an offset? Why do I need to fill out the HTTP authentication dialog twice to log in?), but nothing too egregious. So I've been happily using this program locally for a while. Today, someone needed to access it from outside the network, and not wanting to open up random high ports on the firewall for no good reason, I thought I'd proxy it through Apache and all would be well. Indeed not. I can get to the opening page, but it turns out that Zope is serving up absolute links in its HTML, complete with hostname and port number. Which is pretty ugly, but nothing I haven't seen before. Even if Zope won't let me convince it to generate relative links like a civilized application, surely there's a configuration file somewhere where I can specify the hostname and port number it uses, right? Ha! No. Apparently this sort of thing is done using a component of Zope called -- without apparent irony -- the "Virtual Host Monster." Reading through its documentation evokes that sort of surrealist prose in which one recognizes all the words but can't be sure whether or not they're actually intended to mean something when strung together -- however, I did eventually manage to get things working by adding this to my Apache configuration: RewriteRule ^/foo/(.*) http://localhost:9080/VirtualHostBase/http/example.com:80/foo/$1 [L,P] Yes, that's right -- we're re-writing incoming URIs under /foo/ to prepend the VirtualHostBase bit, and Zope then parses the resultant URI it sees from Apache and deduces that it should use http://example.com:80/foo/ as the base for the links in its response. --Eli
From: John Handelaar Date: 13:56 on 14 Jul 2006 Subject: Re: Transportation of a URI Across Port Boundaries for Immoral Purposes Eli Naeher wrote: > <snip> Zope. I'd like us all to pause for a moment's silence. Partly as recognition of the extreme pain our comrade will experience if he ever needs to connect this thing to the outside world in an untrivial way, and partly because if I get started on Zope now, I won't get anything else done today. [Tip: stay the hell away from caching any part of the proxy chain[1], and always have enough memory to store two copies of the entire Zope Object DB file in RAM.] jh [1] Do we have the time or inclination to express our collective hate for web app developers whose idea of sending the right cache control headers is 'worksformydedicatedIPaddress'? [2] [2] ...or, for that matter, whose idea of performance testing involves running 100 requests through 'ab' and performing some rectal mathematics on the result?
Generated at 10:27 on 16 Apr 2008 by mariachi