代码之家  ›  专栏  ›  技术社区  ›  keepAlive

如何使用uWSGI内部路由将HTTPS重定向到HTTP?

  •  0
  • keepAlive  · 技术社区  · 6 年前

    起初,我以为我可以简单地交换关键参数,如

    1. uwsgi-docs.readthedocs.io#Force HTTPS
    2. How can I redirect HTTP to HTTPS with uWSGI internal routing?

    plugins = router_redirect
    route-if-not = equal:${HTTP};on redirect-permanent:http://${HTTP_HOST}${REQUEST_URI}
    

    这不起作用。因此有以下问题: 如何重定向 超文本传输协议 有uWSGI内部路由吗?


    请注意,从HTTP到HTTPS的(通常需要的)重定向在我的环境中非常有效,即
    plugins = router_redirect
    route-if-not = equal:${HTTPS};on redirect-permanent:https://${HTTP_HOST}${REQUEST_URI}
    

    作品。

    1 回复  |  直到 6 年前
        1
  •  0
  •   ewindes    6 年前

    我猜你会想要这个:

    plugins = router_redirect
    route-if = equal:${HTTPS};on redirect-permanent:http://${HTTP_HOST}${REQUEST_URI}
    

    (……尽管有些浏览器可能会将URL改回https。)