[Chicago] Using WSGI as middleware for CGI
Ian Bicking
ianb at colorstudy.com
Thu Mar 22 00:30:26 CET 2007
Andrew Wilson wrote:
> Hey, guys,
>
> Okay, crazy thought. I need to implement a site-wide authentication
> mechanism, which for usability reasons *must* be cookie based. But
> *sigh* most 3rd-party software really, really prefers HTTP auth. For our
> own applications, I intend to implement a WSGI middleware application
> that transforms cookie information into information on what user is
> logged in (if any). This works great for our own web apps, and also for
> decently behaved Python ones ( e.g. Trac).
>
> BUT. I am forced (by time limits) to use non-Python web applications
> that run over CGI or FCGI.
>
> Is there any way I can re-use my WSGI application as middleware in
> between my webserver (ligghtpd) and a standard CGI script (again,
> translating cookie information into the appropriate CGI information for
> http auth login)?
Of course, WSGI can do everything! There's paste.cgiapp, which wraps
CGI applications in a WSGI interface. There's also past.proxy, which
has a few options for proxying to other apps (but there's no standard
for how you send the auth data -- but you could set a header and make
your non-Python app read that header). There's also wphp.fcgiapp, which
sends a request over FastCGI to an already-started server process. And
wphp, which wraps all that up for running PHP apps specifically.
--
Ian Bicking | ianb at colorstudy.com | http://blog.ianbicking.org
| Write code, do good | http://topp.openplans.org/careers
More information about the Chicago
mailing list