ssl.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:zeus 作者: getsentry 项目源码 文件源码
def redirect_to_ssl(self):
        """
        Redirect incoming requests to HTTPS.
        """
        criteria = [
            request.is_secure,
            current_app.debug,
            current_app.testing,
            request.headers.get('X-Forwarded-Proto', 'http') == 'https'
        ]

        if request.headers.get('User-Agent', '').lower().startswith(self.exclude_user_agents):
            return

        if not any(criteria):
            if request.url.startswith('http://'):
                url = request.url.replace('http://', 'https://', 1)
                r = redirect(url, code=301)
                return r
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号