| Issue 14: | Need to implement internal server redirection. | |
| 1 person starred this issue and may be notified of changes. | Back to list |
Sign in to add a comment
|
The CGI specification allows for a CGI script to return a 'Location' header which refers to a location within the local web server. Quoting the RFC: """If the Location value is a path, then the server will generate the response that it would have produced in response to a request containing the URL""" In Apache this is honoured when the Status returned by the CGI script is also 200. The end result is that rather than sending a redirect back to the web client, Apache will trigger a new sub request against the path (as a GET request) and return the result of that to the web client. Although the WSGI specification doesn't mention any requirement for a WSGI adapter for a web server to do the same thing, it may be an interesting extension to add to mod_wsgi. Although nearly all WSGI adapters would not currently support this, it should already be available where a CGI/WSGI is currently being used if that CGI implementation adheres to the CGI specification. |
||||||||||||
,
Dec 23, 2007
Note that this doesn't play nicely with middleware; if the application sends an internal redirect, then it will bypass any middleware that would transform the headers or response entity. For example, middleware that handles GZIP compression, ETag handling, caching headers, and/or detailed logging would all fail to work correctly with this internal redirect. The wsgi.file_wrapper mechanism ( Issue 5 ) is a similar mechanism that is more flexible and middleware-friendly. http://mail.python.org/pipermail/web-sig/2005-December/001825.html |
|||||||||||||
,
Dec 23, 2007
This would not be intended to replace wsgi.file_wrapper. The target of the redirection could be another dynamically generated page complete with its own middleware stack performing all those functions which you speak of. The target could even be code that uses wsgi.file_wrapper. :-) |
|||||||||||||
,
Dec 23, 2007
More importantly, this feature would allow one to perform an internal redirection to a URL which is implemented by something other than a Python WSGI application. Ie., it recognises that Python isn't the only way of doing things and that people may have URL request handlers written using other systems or custom Apache modules. The target could even be WebDAV URLs or URLs which map through a proxy to another server all together. To do this sort of thing in a WSGI application requires doing a HTTP client request back against the same server which is a clumsy way of doing it. |
|||||||||||||
,
Mar 05, 2009
Implemented in revision 1215 of subversion trunk for 3.0. Note that the feature only works when using mod_wsgi daemon mode.
Status: Started
Labels: Milestone-Release3.0 |
|||||||||||||
,
Nov 21, 2009
Version 3.0 of mod_wsgi now released.
Status: Fixed
|
|||||||||||||
|
|
|||||||||||||