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 & 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 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.

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 {
    server 127.0.0.3:6545 fail_timeout=0;
}

server {
    client_max_body_size 4G;
    server_name 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/-/WriCV7oIMxMJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to