ruby on rails 生产环境配置ssl后报错

rails5 生产环境配置好ssl后报错(nginx需要配置相对应ssl)

 HTTP Origin header didn't match request.base_url

https://github.com/rails/rails/issues/22965 这里有提到

加上

proxy_set_header  X-Forwarded-Ssl on; 

这样就可以了

例子:仅供参考

upstream myapp {
  server              unix:///path/to/puma.sock;
}
...
location / {
  proxy_pass        http://myapp;
  proxy_set_header  Host $host;
  proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header  X-Forwarded-Proto $scheme;
  proxy_set_header  X-Forwarded-Ssl on; # Optional
  proxy_set_header  X-Forwarded-Port $server_port;
  proxy_set_header  X-Forwarded-Host $host;
}

你可能感兴趣的:(ruby on rails 生产环境配置ssl后报错)