1)  pserve isn’t really comparable with gunicorn, its just a way to launch a 
server, such as gunicorn or waitress.  You’re probably using waitress, that’s 
what the Pyramid docs use.

I personally use gunicorn, but many on this mailing list are using waitress 
with success, so I think it’s a fine choice.

Since you’re using Docker, you might be interested in this containerized nginx 
proxy I built:  https://github.com/luhn/docker-gunicorn-proxy 
<https://github.com/luhn/docker-gunicorn-proxy>  (It’s called gunicorn-proxy, 
but should work with waitress too.)

2) I use X-Forwarded-Proto just fine; as far as I can tell that documentation 
is accurate.  You did type “X-Forward-Proto” in your email, so double check the 
spelling in your config :)

3) Unix sockets are supposedly more efficient than localhost because they don’t 
have to deal with that bothersome “internet” stuff.  It might shave a hair off 
your CPU usage.

— Theron



> On Dec 13, 2021, at 4:21 PM, Jens Troeger <[email protected]> wrote:
> 
> Hello,
> 
> I’ve seen some conversation here about running a Pyramid app server inside a 
> Docker container, but none has really answered my questions.
> 
> My setup is that nginx runs on the host and currently uses proxy_pass 
> <https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass> to 
> forward requests to the container’s external port, so that the requests are 
> then processed and responded to by the Pyramid application running inside the 
> container.
> 
> Question: Inside the container I’m running the Pyramid application using 
> pserve 
> <https://docs.pylonsproject.org/projects/pyramid/en/latest/pscripts/pserve.html>
>  which listens on the container’s mapped internal port. Should I switch to 
> gunicorn <https://docs.gunicorn.org/en/stable/> instead? Does it matter in 
> such a setup?
> 
> The proxy_pass URL is http://127.0.0.1:6543 which means that the external 
> https gets lost. That, in turn, means that within the Pyramid app (inside of 
> the container) calls to e.g. static_url() 
> <https://docs.pylonsproject.org/projects/pyramid/en/latest/api/request.html#pyramid.request.Request.static_url>
>  return a http route instead of the necessary & expected https.
> 
> Question: I currently use prefix WSGI middleware to rewrite responses 
> (discussion 
> <https://github.com/Pylons/pyramid/issues/1435#issuecomment-61654089>) but 
> that feels hacky. Unfortunately, I wasn’t able to make X-Forward-Proto 
> <https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-Proto> 
> HTTP header work quite yet so what’s the current recommendation here? Is the 
> Using Behind a Reverse Proxy 
> <https://docs.pylonsproject.org/projects/waitress/en/latest/reverse-proxy.html>
>  page current and working?
> 
> Question: Are there any benefits to using a UNIX socket for proxy_pass, 
> instead of HTTP?
> 
> Much thanks in advance!
> Jens
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "pylons-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/pylons-discuss/508f077e-ff7e-47c4-9e8f-ee5f018e9a7en%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/pylons-discuss/508f077e-ff7e-47c4-9e8f-ee5f018e9a7en%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/9D325A1D-2ACD-444B-B176-79F1706219D2%40luhn.com.

Reply via email to