[mod_python] Help with mod_python, mod_proxy & cookies

Graham Dumpleton grahamd at dscpl.com.au
Wed Jan 24 23:02:13 EST 2007


Marc Boorshtein wrote ..
> >
> > Forgot the second half of the problem. In the same file add:
> >
> >   def mycookiefixup(filter):
> >     # interrogate req.headers_out, get out cookie headers, change
> >     # them and ressign it.
> >     filter.pass_on()
> >
> > Then in the fixuphandler() have:
> >
> >   req.register_output_filter("MYCOOKIEFIXUP", mycookiefixup)
> >   req.add_output_filter("MYCOOKIEFIXUP")
> >
> > This will register the filter function as an output filter from within
> > the handler, allow you to change the cookies on the way back as
> > well.
> 
> OK, this works ALMOST perfectly.  What about an equivalent to
> ReverseProxyPass? I need to be able to handle redirects with cookies
> as well.

Do you mean ProxyPassReverse?

The example should have been equivalent to that. The values for proxyreq are:

  PROXYREQ_NONE = 0       # No proxy
  PROXYREQ_PROXY = 1      # Standard proxy
  PROXYREQ_REVERSE = 2    # Reverse proxy
  PROXYREQ_RESPONSE = 3   # Origin response

I believe that PROXYREQ_PROXY is equivalent to ProxyPass and PROXYREQ_REVERSE
as used is equivalent to ProxyPassReverse.

If you need Apache 2.2 equivalent of ProxyPassReverseCookieDomain or
ProxyPassReverseCookiePath then I don't know how to set that up and would
need to look again at Apache source. I don't know what fixups you were
wanting to make to the cookies, but it wasn't something you could just
do with these Apache 2.2 directives is it?

Graham


More information about the Mod_python mailing list