Home  >  Q&A  >  body text

python - flask application routing to other ports, HTTP service

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

    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">

Seeking specific solutions

为情所困为情所困2686 days ago851

reply all(1)I'll reply

  • 伊谢尔伦

    伊谢尔伦2017-06-12 09:29:24

    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!

    reply
    0
  • Cancelreply