Beego 备忘

IsSecure() func 失效问题

nginx部署好https后,this.Ctx.Input.IsSecure() 返回 false
解决方法,nginxconf中需要加入 proxy_set_header X-Forwarded-Proto $scheme;

   location / {
        try_files /_not_exists_ @backend;
    }

    location @backend {
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header Host            $http_host;
	proxy_set_header X-Forwarded-Proto $scheme;
        proxy_pass http://127.0.0.1:8083;
    }
posted @ 2021-08-27 18:10  Au_ww  阅读(45)  评论(0编辑  收藏  举报