python - flask application routing to other ports, HTTP service
为情所困
为情所困 2017-06-12 09:27:24
0
1
890

I have a flask application, bound to ip and port. Suppose there is another HTTP application (such as flower, or it has nothing to do with flask, I only know the interface of this application, and it can only be accessed locally). I want some rules of the flask application to be completely forwarded to this application that has nothing to do with flask. How should I do this?
Use guncion nginx deployment

  • Configure in nginx:

    location /flower/ {
        rewrite ^/flower/(.*)$ / break;
        proxy_pass http://127.0.0.1:5555/;
        proxy_set_header Host $host;
    }

There will be situations where resource files cannot be routed, and the following applications cannot be found:

<link href="/static/css/bootstrap-responsive.css?v=702e8485242b3ae5b4ce75a5ede13acb" rel="stylesheet">
  • Forwarding at the flask layer?

  • Forwarding at wsgi layer? werkzeug middleware?


Seeking specific solutions

为情所困
为情所困

reply all(1)
伊谢尔伦

Your situation should be cross-domain. You can use nginx + lua to distribute sub-requests. Your nginx needs to recompile the lua module

You can take a look at the following ideas
http://zqscm.qiniucdn.com/dat...

As for making nginx support lua, you can google this yourself. I wish you success!

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template