简体   繁体   中英

Rails URL helpers return non-https URLs though default_url_options set to https

I have Nginx serving the SSL. On the rails side it's a Puma and I have config.action_mailer.default_url_options = { protocol: 'https', host: example.com but my root_url still returns http://example.com

You need to set proxy_set_header X-Forwarded-Proto https; in your nginx config so Rails would see your request as HTTPS. Here is another issue that is caused by absence of this header - force_ssl would cause endless redirection: https redirect for rails app behind proxy?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM