使用ATS将流量从一个端口重新映射到另一个端口

时间:2016-12-01 19:07:46

标签: django

我在端口2501上部署了django应用程序。我将ATS配置为终止HTTPS,并充当反向代理以将流量路由到2501;我的配置如下:

string.length()

这很有效,每当你点击https:// ...你终止https并且流量被路由到2501.但是如果你访问2501,你也可以正常访问该网站。有可能这样做,如果你访问2501它会让你回到443吗?我尝试使用reverse_map,但它不适合我(也许我误解了反向映射的作用?)

map https://example.com:443/ http://127.0.0.1:2501/

这是我的uwsgi.ini的样子:

reverse_map http://example.com:2501/ https://127.0.0.1:443/

1 个答案:

答案 0 :(得分:1)

我刚刚在我的服务器上运行了一些测试,看起来应该已经很好了。

这是我试过的:

$ uwsgi --http :9090 --wsgi-file hello-world.py
# I can see the server from an external request.

$ uwsgi --http-socket :9090 --wsgi-file hello-world.py
# I can see the server from an external request.

$ uwsgi --http 127.0.0.1:9090 --wsgi-file hello-world.py
# I cannot see the server from an external request.

$ uwsgi --http 127.0.0.1:9090 --wsgi-file hello-world.py
# I cannot see the server from an external request.

通过在该行中包含127.0.0.1进行配置,外部IP 不应能够访问该应用程序,但Apache或NginX应该。