Description
Describe the bug...
Steps to reproduce
Setup moin 1.5rc1 on Linux + Apache (eg http://brewiki.org/SystemInfo).
Add apache url rewriting rules to make wiki pages top level. This means that top level urls will load the expected page, however links within the wiki show the long (non top level url). Eg FrontPage tab now has url of http://brewiki.org/moin/wiki/server/moin.cgi/FrontPage (cf http://brewiki.org/FrontPage). This is inconvenient but not totally broken.
Attempt to fix this by trying technique in note 2 at HelpOnInstalling/ApacheOnLinux. That is, add properties = {'script_name': '/'} to RequestCGI() call.
- URLs are now good (top level) however my session is broken, clicking any link effectively logs me out.
It seems the behaviour is consistent no matter how the URL was generated, if you type in a short URL in the browser address bar, it seems you lose your session. You can use this approach to reproduce the symptoms at the link above since I have put back moin.cgi the way it was.
Example
I have removed the property parameter to RequestCGI() in moin.cgi for now, so now it is just the long URLs.
Details
MoinMoin Version |
|
OS and Version |
|
Python Version |
|
Server Setup |
|
Server Details |
|
I believe the only info I have is here: http://brewiki.org/SystemInfo
Please note that the "long URL" issue was present in moin 1.1 which I was using until today.
My rewriting rules (in .htaccess):
# redirect 1.1 installation legacy links. RedirectMatch /wiki/homebrew/moin.cgi(.*) http://brewiki.org$1 Options +ExecCGI AddHandler cgi-script py RewriteEngine on RewriteBase / RewriteCond %{HTTP_HOST} brewiki.org [NC] RewriteRule ^/?$ moin/wiki/server/moin.cgi #RewriteRule ^$ moin/wiki/server/moin.cgi RewriteRule ^OaH(.*)$ optushome$1 RewriteRule ^([A-Z].*)$ moin/wiki/server/moin.cgi?$1 RewriteRule \?(.*)$ moin/wiki/server/moin.cgi?$1 RewriteCond %{REQUEST_URI} brewiki[\?/]?(.*)$ RewriteRule brewiki/([A-Z].*)$ moin/wiki/server/moin.cgi?$1 RewriteRule brewiki/?$ moin/wiki/server/moin.cgi RewriteRule brewiki\?(.*)$ moin/wiki/server/moin.cgi?$1
Workaround
I am just living with long URLs.
Check out the discussion where I reference the HelpOnConfiguration/ApacheVoodoo, it's a work around that works. -- TravisBradshaw
Discussion
ThomasWaldmann observed that the URL stored in the cookie used the full URL, not the shortened, top level URL, hence the name of the page.
- FIX (almost)
- set cookie_path = '/' in wikiconfig. Note that the config page could mislead naive people like me into thinking this only applied to wiki farms. BTW I have only been running this fix for a short while so I don't know whether there are other unwanted side effects. It turns out there are side effects. I can no longer edit pages. The page refreshes but there is no editor, no error message. Back to the drawing board.
I recently set up an apache2 cgi-based wiki following the HelpOnConfiguration/ApacheVoodoo page and it worked without any other special changes. So I guess it is just your rewrite rules making your life harder than necessary. -- ThomasWaldmann 2006-01-15 17:13:48
It's not just "[the] rewrite rules making your life harder than necessary." His changes were in the root .htaccess file, not in the apache configuration file. The environment for the rewrite rules are different in the .htaccess file in a way that makes the suggestions on HelpOnConfiguration/ApacheVoodoo not work. The issue is that for some reason MoinMoin doesn't have an option to explicitly specify the "root" in a way that makes all links absolute rather than relative. The easy solution would be a configuration option that says wiki_root = '/' instead of having the cgi script use relative links for everything. Lacking the ability to have "clean" URI's is a showstopper for everyone that doesn't have root access to their hosting environment. -- TravisBradshaw
Whoa! Real work around! This little jewel was tucked into HelpOnInstalling/ApacheOnLinux under Note 2 where he said this in reference to the moin.cgi script! -- TravisBradshaw
Note 2: In this file there is a line reading request = RequestCGI(). If you have a complex mod_rewrite case, you might want to add properties = {'script_name': '/mywiki'} in the parenthesis. This will let MoinMoin generate URLs that start with /mywiki and not the path that the webserver passed to MoinMoin
Comment from PaulSorenson: well I haven't had much success so far with Thomas' tip re HelpOnConfiguration/ApacheVoodoo. I was just getting server errors (500) on my web host and since I don't have access to the apache logs it made it difficult to figure out what I had screwed up. I will get back once I have chance to take another look at it.
Working with 1.5.3
Today I updated another wiki on the same web server to 1.5.3 and seem to have it all working. Its deliberately not quite root so as not to break the production wiki but I believe the principle will apply to a root wiki. The following stuff could probably now move out of here, because there appears to no longer be any issue with the cookie URL.
Here again I don't have access to httpd.conf. The URL (probably temporary) http://www.melbournebrewers.org/w/FrontPage. Note that the configs below have the "w/" in them. This would presumably be "/" in a root wiki.
There are some slight but significant differences between the apache config below and that shown in ApacheVoodoo.
# root .htaccess file RewriteEngine On # This make for server errors at my webhost. #RewriteLogLevel 0 # It didn't work without this RewriteBase / # Root wiki rules # Point to moin shared static files. # In wikiconfig.py this should correspond to url_prefix = '/_static' RewriteRule ^_static(.*)$ wiki15/htdocs$1 [last] # Map everything else to moin cgi script RewriteRule ^w/([A-Z].*)$ wiki15/server/moin.cgi/$1 [type=application/x-httpd-cgi]
# wikiconfig.py ... # Setup for "root mounted" - see also .htaccess.root url_prefix = '/_static' ...
# moin.cgi ... from MoinMoin.request import RequestCGI request = RequestCGI(properties={'script_name': '/w'}) ...
I didn't touch the cookie stuff and I seem to be remembered between sessions and editing works.
Thanks to all who helped out.
-- PaulSorenson 2006-05-08 11:17:59
Plan
- Priority:
Assigned to: AlexanderSchremmer
- Broken by: Enterprise Edition branch.
- Status: Fixed in moin--main--1.5--patch-401.