简体   繁体   中英

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

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, ie, doing

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

works.

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.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM