Trac on IIS - redirect problems.
|Reported by:||Owned by:||Christopher Lenz|
|Severity:||blocker||Keywords:||IIS redirect CGI windows|
Description (last modified by )
This has taken 3 days to trac (wink) down. GRRRRRRRRR - it's not your fault - it's MS's crazy CGI implementation.
If you can manage to get Trac installed and running on IIS (see tickets #693 #692) then you will find that viewing pages (http GET's) works correctly but any attemt to perform a http POST will stall the server or result in Trac error messages.
- " Sorry, Cannot create new version, this page has already been modified by someone else." - for the Wiki.
- 10's - 100's of identical tickets created when you submit the new ticket form.
- IIS gets an stack overflow. (i've not seen this but it's been reported and seems likely).
The cause is this: http://support.microsoft.com/default.aspx?scid=kb;en-us;221154
Which is bizzarly cryptic but basically - if you watch network traces of the post occuring you will never see the 302 redirect come back from the server. The reason is because IIS issues the GET request on the serverside if the Location: header is relative. This results in an infinate loop for tickets and an write conflict for Wiki pages (version mismatch).
The work around I have discovered is as follows:
class Request: def redirect(self, url): add the following line: #the http://servername bit only! - i.e. no script path etc. base_url = '%s://%s' % ("http", os.getenv('SERVER_NAME')) change the following: self.send_header('Location', burl + url)
This forces the Location: header to be absolute which keeps everything working.
I know this is rubbish. It will break for HTTPS and really the base_url code should be moved into the Request class (?? maybe? ) so that all the base_url logic is in one place.
Change History (16)
comment:13 by , 15 years ago
|Status:||reopened → new|
comment:14 by , 15 years ago
|Priority:||low → high|
|Status:||new → assigned|