How can I redirect HTTPS to HTTP with uWSGI internal routing?

无人久伴 提交于 2019-12-25 03:16:35

问题


For some reasons, I need to force HTTP for my whole site.

At first, I thought that i could simply interchange key-parameters such as those shown in

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

leading me to do:

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

which does not work. Hence the following question: How can I redirect HTTPS to HTTP with uWSGI internal routing?


Note that the (commonly wanted) redirection from HTTP to HTTPS perfectly works within my environment, i.e., doing
plugins = router_redirect
route-if-not = equal:${HTTPS};on redirect-permanent:https://${HTTP_HOST}${REQUEST_URI}

works.


回答1:


I'm guessing that you'd want this:

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

(...although some browsers may then change the URL back to https.)



来源:https://stackoverflow.com/questions/53592777/how-can-i-redirect-https-to-http-with-uwsgi-internal-routing

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!