Can I use the uwsgi protocol to call http?

前端 未结 3 1616
自闭症患者
自闭症患者 2020-12-21 16:47

Here\'s a data flow: http <--> nginx <--> uWSGI <--> python webapp

I guess there\'s http2uwsgi transfer in nginx, and uwsgi2http in uWSGI.

What if I

3条回答
  •  天命终不由人
    2020-12-21 17:02

    Try using uwsgi_curl

    $ pip install uwsgi-tools
    
    $ uwsgi_curl 10.0.0.1:3030 /path
    

    or if you need to do some more requests try uwsgi_proxy from the same package

    $ uwsgi_proxy 10.0.0.1:3030
    Proxying remote uWSGI server 10.0.0.1:3030 "" to local HTTP server 127.0.0.1:3030...
    

    so you can browse it locally at http://127.0.0.1:3030/.

    If your application allows only certain Host header, you can specify host name as well

    $ uwsgi_curl 10.0.0.1:3030 host.name/path
    
    $ uwsgi_proxy 10.0.0.1:3030 -n host.name
    

    If application has static files, you can redirect such requests to your front server using -s argument. You can also specify different local port if needed.

提交回复
热议问题