El 2013-09-07 20:12, Roberto De Ioris escribió:
Hello,

I have configured uWSGI in order to proxy to an http server and, after
that, transform the response from the http server through the XSLT
transformation plugin. It works. The relevant config is:

route= ^/
toxslt:stylesheet=/whatever/template.xslt,content_type=text/html
route= ^/ proxyhttp:127.0.0.1:8002

With this I am able to XSLT-transform every response from the
127.0.0.1:8002 server.

The problem is that I would like to do this *only* when the response is a Content-type=text/html (whatever the URL is, i.e. it cannot be done by file extension. It must be by the Content-type header of the response)

Is there a way to apply the transformation depending on the response
from the server?

I also considered using python code to setup the "transformation chain" on the fly as the response reaches back to the uWSGI instance, but it is
poorly documented, I just don't know how to do it. Any idea?

Thank you.

Pablo.



Thank you for your quick answer.

There is still no way to check response headers (honestly i still need to find a proper solution). Currently you can only check the HTTP status, using the error-route chain (it is a routing chain run after the response
generation but before transformations)

Is it documented? I did not see it.

Anyway, that would be too expensive for this use case.

This limit is general, so even running custom code in routing handler does
not solve the issue.

Not as the most elegant and final solution, but maybe a very simple transformation plugin that just checks for a variable or header, and interrupts the transformation chain if matched...

Thanks again for your help.

Pablo.
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to