问题描述
使用redirect_to跳转时子域名丢失,比如跳转到subdomain.example.com/admins/users时nginx会帮你解析到subdomain.example.com/admins/.example.com/admins/users
解决方法
在nginx配置文件里面添加如下代码
proxy_redirect off;
比较完全的配置如下:
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
}