How to set passenger 5 config file on heroku

A Rails app is hosted on heroku and uses passenger 5 as the server.

SSL is required to work for the main domain as a wildcard but should not work for any other user custom domain. To achieve this the ruby gem rack-ssl-enforcer (https://github.com/tobmatth/rack-ssl-enforcer) has been chosen.

I've aded the following to production.rb

config.middleware.insert_before ActionDispatch::Static, Rack::SslEnforcer, strict: true, only_hosts: /$.mydomain.com$/, only_environments: 'production', redirect_code: 302

with strict: true however all URLs end up in redirect loop. This is noted as an issue related to nginx/passenger that can be resolved by

In the location block for your app's SSL configuration, include the following proxy header configuration:

proxy_set_header X-Forwarded-Proto https;

How in a Heroku Rails app can this single config option be set?

链接地址: http://www.djcxy.com/p/60108.html

上一篇: 根据SAML IDP对移动用户进行身份验证

下一篇: 如何在heroku上设置乘客5配置文件