如何使用uWSGI内部路由将HTTPS重定向到HTTP? [英] How can I redirect HTTPS to HTTP with uWSGI internal routing?
本文介绍了如何使用uWSGI内部路由将HTTPS重定向到HTTP?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
由于某些原因,我需要为整个站点强制使用HTTP.
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
- uwsgi-docs.readthedocs.io#Force HTTPS
- 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}
这不起作用.因此,出现以下问题:如何重定向 HTTPS 到 HTTP 使用uWSGI内部路由?
which does not work. Hence the following question: How can I redirect HTTPS to HTTP with uWSGI internal routing?
请注意,(通常需要的)从HTTP重定向到HTTPS的操作在我的环境中非常有效,即
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}
有效.
推荐答案
我猜你想要这个:
plugins = router_redirect
route-if = equal:${HTTPS};on redirect-permanent:http://${HTTP_HOST}${REQUEST_URI}
(...尽管某些浏览器随后可能会将URL改回https.)
(...although some browsers may then change the URL back to https.)
这篇关于如何使用uWSGI内部路由将HTTPS重定向到HTTP?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文