Debug toolbar, reverse proxy, and HTTPS

58 views
Skip to first unread message

Mike Orr

unread,
May 3, 2017, 9:50:46 AM5/3/17
to pylons-...@googlegroups.com
My organization asked me to shift development from my workstation to
an internal server I ssh into. The server is CentOS and they don't
have a remote graphical desktop working yet so I can't run a graphical
browser on it; I have to run a webserver and preview the site locally.
That requires HTTPS, so I have it running under Apache with
mod_proxy_http to waitress, That breaks the debug toolbar: it shows
the initial traceback page but the interactive traceback and the
Python shell don't work, which makes debugging more difficult. I
believe it's the typical problem with reverse proxies: the application
thinks it's serving on 'localhost' and generates URLs that don't work
in the external browser. In Pylons there's some configuration trick to
overcome this. How do you do it in Pyramid?

Second, is there an easy-to-install Python webserver with HTTPS? We
have uwsgi running on another site (mod_proxy_uwsgi), and if I run it
standalone it would obviate the need for Apache and a proxy. But uwsgi
has extensive C code so it can be hard to install, and the
documentation is horrible. Sometimes I couldn't get it compiled, and
other times it started but failed for some SSL reason (with a generic
error message that doesn't tell you what to look for). I looked at
Waitress and CherryPy but they don't seem to have HTTPS, and adding it
on seems like a lot of work when you haven't dealt with the low-level
libraries before. So is there a simple Python solution for an HTTPS
server?

Third, I can probably use any non-HTTP proxying, which would keep the
exernal HTTP headers intact so the application can generate the right
URLs. For that I could use 'mod_proxy_uwsgi;, but then I have to get
uwsgi working which comes back to the second problem. In the ancient
past I used 'mod_scgi' and some others used 'mod_fcgi'. Is it worth
going back to those, and would the debug toolbar in fact work under
them?

--
Mike Orr <slugg...@gmail.com>

Oliver

unread,
May 3, 2017, 3:23:16 PM5/3/17
to pylons-...@googlegroups.com
pyramid uses wsgi.url_scheme for url generation:
https://github.com/Pylons/pyramid/blob/01c3afac1c80336c6ca9df85969916c7e41e45a1/pyramid/url.py#L91

so you can use a middleware like PasteDeploy#prefix:
https://bitbucket.org/ianb/pastedeploy/src/4b27133a2a7db58b213ae55b580039c11d2055c0/paste/deploy/config.py?at=default&fileviewer=file-view-default#config.py-273:276
or write your own...

this is also described in the docs: http://docs.pylonsproject.org/projects/waitress/en/latest



for the python proxy, there is a package https://pypi.python.org/pypi/mitmproxy which might be useful


best regards
Oliver
Reply all
Reply to author
Forward
0 new messages