Closed jpoehls closed 4 years ago
Python world is slowly moving towards ASGI (https://asgi.readthedocs.io/en/latest/introduction.html) - I guess it would be unrealistic to expect support for both... :)
If there's a Go implementation, it is not hard to extend Caddy to support these protocols. If there isn't a Go implementation, someone needs to write one first.
This is currently Caddy's oldest open issue, and with v2 being released probably a couple weeks from now, I'm going to close this issue because even if I/we do implement it, it won't be a part of the standard modules, it'll be something that has to be plugged in (i.e. it will live in a separate repo). It's just not actionable for our core project at this point.
The discussion can continue as needed, and I think it'll be great if somebody implements this as a handler module for v2!
I'm havin' no real troubles using Caddy in front of a GUnicorn/Uvicorn/FCGI backend as a transparent reverse proxy, same as I'd do with nginx. If this is too much effort for very little gain, you're totally doin' the right thing putting it on the back burner for now. All good here. Just keep makin' Caddy what it's always been. A great little lightweight and powerful web server. Thanks much for that. I'ma huge fan since first discovering Caddy. :)
I'm havin' no real troubles using Caddy in front of a GUnicorn/Uvicorn/FCGI backend as a transparent reverse proxy, same as I'd do with nginx. If this is too much effort for very little gain, you're totally doin' the right thing putting it on the back burner for now. All good here. Just keep makin' Caddy what it's always been. A great little lightweight and powerful web server. Thanks much for that. I'ma huge fan since first discovering Caddy. :)
Hey, I'd love to hear what issues you're having. I'm having some odd problems running Caddy for the same in front of a gunicorn backend (using tiangolo's gunicorn-flask container). It behaves fine when I just use flask run ... but when I run the app on gunicorn(+greenlet and meinheld, to be precise) I get some really odd behavior. Specifically, some static files pseudo-randomly can't be served and performance seems really unpredictable). I thought it was gunicorn but I wonder if it's Caddy and whether to switch the proxy over to nginx.
@maquino1985 what we typically suggest is to play around with the buffer_requests
and flush_interval
options of reverse_proxy
when using gunicorn. We've seen those help resolve issues for those users. Those options are inefficient though, but are apparently sometimes necessary due to gunicorn's weird behaviour. https://caddyserver.com/docs/caddyfile/directives/reverse_proxy#streaming
If you have any more usage questions, I recommend asking on the forums next time, https://caddy.community, instead of replying a 6 year old issue with a couple dozen participants who may receive emails. Thanks for understanding!
I checked NGINX Unit documentation for deploying FastAPI and Django Channels. Id you use NGINX Unit, you do not need Uvicorn, Hypercorn, Daphne. ASGI is built into it.
Someone just created a plugin which calls WSGI directly from Caddy! :tada: It requires building with CGO, but that should be fine :+1:
Thanks for working on this @mliezun
I don't have time (or expertise) to contribute this but I'd definitely be interested in using it so I figured I'd create the feature request and try to gather interest.
I :heart: Caddy and want to use it for all the things. That includes serving up my Django app via WSGI.
I imagine this working similar to the
proxy
directive where you tell it to serve some directory via WSGI. (Forgive my perhaps incorrect use of terms, I'm a Python noob.)I found this package for serving WSGI apps via Go but not sure of its production readiness.