[Moin-user] URL-prefix/path-info with twisted: solution
Thomas Werschlein
thomas.werschlein at netcetera.ch
Thu Feb 17 05:12:01 EST 2005
I found the following solution to the problem:
MoinMoin.request.RequestTwisted.__init__:
# orig:
# self.script_name = "/" + '/'.join(self.twistd.prepath[:-1])
self.script_name = os.environ.get('SCRIPT_NAME', '/') +
'/'.join(self.twistd.prepath[:-1])
MoinMoin.request.RequestTwisted.__init__:
# orig:
#url = "http://%s:%s%s" % (self.server_name, self.server_port, url)
# we use SSL
url = "https://%s:%s%s" % (self.server_name, self.server_port, url)
MoinMoin.server.twistedmoin.WikiRoot.getChild:
# orig:
# if request.prepath == [] and name == 'wiki':
if request.prepath == [] and name == 'mywiki':
# orig:
# return self.children['wiki'].getChild(name, request)
return self.children['mywiki'].getChild(name, request)
MoinMoin.server.twistedmoin.makeApp:
# orig:
# default.putChild('wiki', static.File(config.docs))
default.putChild('mywiki', static.File(config.docs))
wikiconfig.py:
os.environ['SCRIPT_NAME'] = '/mywiki'
Obviously, the changes to MoinMoin.server.twistedmoin (replacing the
hardcoded "wiki" prefix to "mywiki") is a quick and dirty hack. But
since the config is not sourced at this point in time (?), I didn't
see a possibility to make this more configurable. Especially I see
problems when running a wikifarm that should have different document
roots each.
Thanks to Alexander and Paul for their contributions!
Regards, Thomas
On Wed, 9 Feb 2005, Thomas Werschlein wrote:
> Hello,
>
> I've to run a twisted based MoinMoin behind an Apache server using
> mod_proxy. Unfortunately I can't use a special DNS-Name for the wiki,
> but have to use a subdirectory to pass requests over to Moin. E.g.:
>
> I can't use mywiki.example.com --> localhost:8080
> but have to use www.example.com/mywiki --> localhost:8080
>
> Now, the problem is, that all subsequent links within Moin don't work,
> since they don't include the "mywiki" prefix in the URL but look like
> www.example.com/RecentChanges instead of
> www.example.com/mywiki/RecentChanges, so mod_proxy can't pass the
> request on to Moin.
>
> Does anyone know where to include this twisted-"prefix"? The
> url_prefix configuration option only affects static content like CSS
> and images (which I can handle with another ProxyPass directive in
> Apache).
>
> Any hints are greatly appreciated!
>
> Regards, Thomas
More information about the Moin-user
mailing list