user8640638
user8640638

Reputation:

Why i have a HTTP problem in my rails 5 app using chrome after adding ssl Nginx?

I have a 5 rails application deployed on a VPS with (ubuntu 18.04 and Nginx) using capistrano, at first everything works perfectly, but I had to install a certaficat of security (letsencrypt) for the HTTPS, the application works in HTTPS but when I try to make a post request I see in the browser this message "The change you wanted was rejected."

And this is what my log shows

HTTP Origin header (https://domainename) didn't match request.base_url (http://domainename)

I saw some link talks abouts the same probleme, i tried their solutions but it does not work for me

Devise doesn't login in Google Chrome

https://github.com/rails/rails/issues/22965

https://github.com/plataformatec/devise/issues/4847

NOTE

I haven't this problem when i use Mozilla Browser !!!! but i have it with (Chrome, Opera, Safari ...)

Upvotes: 2

Views: 1111

Answers (1)

user8640638
user8640638

Reputation:

I fixed it by adding this:

proxy_set_header X-Forwarded-Ssl on;
proxy_set_header X-Forwarded-Port 443;
proxy_set_header X-Forwarded-Host $ host;

in the part @puma in my nginx.conf, I had this problem because I use capistrano for the deployment, it changes a little bit the configuration of the file nginx.conf I hope it will help somebody ! :)

Upvotes: 3

Related Questions