search

Home  >  Q&A  >  body text

python - Tornado如何让http跳转到https

我在tornado的prepare判断self.request.protocol=='http'则redirect到https,但这样就访问http会有问题,如何解决?我没有用nginx
补充一下,貌似是重定向过多导致的?

PHPzPHPz2890 days ago437

reply all(3)I'll reply

  • PHP中文网

    PHP中文网2017-04-17 17:57:18

    The questioner means that you want to use http for some requests and https for some requests.

    It is also recommended to use nginx to do it. There are two methods.

    1. If you use two domain names (or different sub-domain names), one is paired with http and the other is paired with https, so it is easy to understand. Mixing it will definitely give people a very confusing feeling;

    2. Use nginx to configure different locations, and redirect http requests that need to use https to https.

    reply
    0
  • 天蓬老师

    天蓬老师2017-04-17 17:57:18

    Use Nginx

    reply
    0
  • 大家讲道理

    大家讲道理2017-04-17 17:57:18

    It is strongly recommended to use nginx. If you encounter http, you can directly rewrite and forward it to https.

    reply
    0
  • Cancelreply