Hi, On 14/06/2012 18:36, Mark Huang wrote:
So I went to do some self study and realized that Pyramid response object did not support such a header natively. There seemed to be a package called wsgithumbs <http://packages.python.org/wsgithumb/index.html> that did something like this, only thing is, the documentation was rather poor.
Contributions are welcome ;) I recently moved the code to the pyramid-collective https://github.com/pyramid-collective/wsgithumb Cheers, Gael
Andi, could you illustrate what your setup was on Pyramid to do this X-Accel thingy? On Thursday, 14 June 2012 14:58:26 UTC+8, Mark Huang wrote: Hi, I'm not sure if this question belongs here because it touches Pyramid as well as Nginx. I have two web applications, one called rhino another called mantis (rhino.abc.com <http://rhino.abc.com> & mantis.abc.com <http://mantis.abc.com>). Mantis is some sort of web service without any page templates; it converts data sent from Rhino into PDFs or Excel documents. I've done something similar in the past; sending data cross domain using JSONP, but then I switched to using Apache ProxyPass, unfortunately, I had a server specialist to set that up for me. I want to use Nginx's proxy_pass directive but I'm not too sure how to set it up so that Pyramid works with it. Scenario use case: User clicks on a button in the UI. This triggers an ajax request to the backend of Rhino. Rhino pulls and processes data and returns a data structure as a response to the ajax request. Here comes the tricky part (unsure part): I send another ajax request to rhino.abc.com/pdf/reports/get_doc <http://rhino.abc.com/pdf/reports/get_doc> with the response data. Nginx "understands" the /pdf/reports/get_doc path and uses proxy pass to "redirect" that to mantis as mantis.ebalu.com/pdf/reports/get_doc <http://mantis.ebalu.com/pdf/reports/get_doc>. My question here: Is there a way for Pyramid to immediately send the processed data to Mantis without having to respond to the ajax request and then making a secondary ajax request to Mantis? My mantis nginx configuration isn't doing anything special here, but my rhino nginx configuration is as follows: upstream rhino.ebalu.com <http://rhino.ebalu.com> { server 127.0.0.3:6545 <http://127.0.0.3:6545> fail_timeout=0; } server { client_max_body_size 4G; server_name rhino.abc.com <http://rhino.abc.com>; keepalive_timeout 8; root /web/data/prod/rhino/rhino; error_log /web/data/logs/rhino/error.log; access_log /web/data/logs/rhino/access.log; location = /favicon.ico { return 204; access_log off; log_not_found off; } location / { proxy_set_header X-Forwarded_For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_redirect off; if (!-f $request_filename) { proxy_pass http://rhino.abc.com; } } location ^~ /pdf/ { #rewrite ^/pdf/(.*) /pdf/$1 break; <------What do I do here? *proxy_pass http://mantis.abc.com/;* } } Can someone please help me out? Regards, Mark Huang -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To view this discussion on the web visit https://groups.google.com/d/msg/pylons-discuss/-/U8pW5dvmDnwJ. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
-- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.