[TriZPUG] Who is using Apache httpd in front of Python, webapps?

Jeff Trawick trawick at gmail.com
Thu Apr 17 02:32:35 CEST 2014


On Wed, Apr 16, 2014 at 5:24 PM, Jim White <jbw2003 at earthlink.net> wrote:

>  Hi,
>
> I have just started using my first python webapp. I am using mod_proxy to
> reverse proxy like this:
>
> ProxyPass /wps http://localhost:5000
>
> This is a tornado server run by supervisord. My app is written in Flask.
> This all works except that apache is not setting the correct headers and I
> have to hack my own middleware with something like this:
>
> environ['SCRIPT_NAME'] = script_name
>

The web server can't naturally know SCRIPT_NAME for a reverse proxy setup
like that, but if the backend can get hints from the URI path, you could use

ProxyPass /wps http://localhost:5000/some/path/that/helps/application

Or if for some reason it is easier to configure in the web server than on
the app side then you can set whatever header are needed to "hard code" the
information (X-SCRIPT-NAME or whatever the backend is looking at).



> http://flask.pocoo.org/snippets/35/
> http://flask.pocoo.org/docs/deploying/wsgi-standalone/#proxy-setups
>
> As I am the sole developer where I work I'm not sure if this approach is
> all best practices, etc.
>
> Jim
>
>
> --
> James B. White
> Cary, NC
> H: 919-380-9615
> M: 919-698-1765
> White Coding and Maps <http://whitecodingandmaps.com/>
>



-- 
Born in Roswell... married an alien...
http://emptyhammock.com/
http://edjective.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/trizpug/attachments/20140416/9dc3b3fc/attachment.html>


More information about the TriZPUG mailing list