问题
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?
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