Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can Quart (the ASGI Flask alternative) be proxied through nginx?

I currently have a Flask app proxied behind Nginx via uWSGI. Due to my needs for asyncio and websockets, I would prefer to switch to Quart.

I use nginx to manage authentication and performantly/simply serve static files. It would be nice to keep essentially the same configuration through the changeover to Quart, as opposed to trashing it all and running Hypercorn bare; and migrating all my static routes/auth into the Quart app.

What config settings are needed to proxy Quart behind nginx? Perhaps more generally, can Nginx proxy an ASGI application? Is this a sensible thing to do?

like image 798
trbabb Avatar asked Nov 17 '25 11:11

trbabb


1 Answers

It can, and you don't need to change any of the settings (unless you weren't using WebSockets with Flask, in which case you need to setup nginx to proxy WebSockets as well). I would recommend running Hypercorn directly though as it will allow you to utilise HTTP/2 features in Quart i.e. server-push.

like image 197
pgjones Avatar answered Nov 19 '25 09:11

pgjones



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!