I was trying to implement https on a subdomain. I have included SSL_requriment plugin
my application controller has two statements:
include SslRequirement
ssl_required if ENV["RAILS_ENV"] == "production"
I have generated key, csr and crt and specified this in apache config file:
<VirtualHost *:80>
ServerName app.my_app.com
DocumentRoot /home/me/my_app/production/current/public
</VirtualHost>
<VirtualHost *:443>
ServerName app.my_app.com
DocumentRoot /home/me/my_app/production/current/public
SSLEngine on
SSLCertificateFile /home/me/my_app/production/shared/plusrev.crt
SSLCertificateKeyFile /home/me/my_app/production/shared/plusrev.key
</VirtualHost>
Still my subdomain is not redirecting to https. Anything I am missing.
Checkout this post: http://www.simonecarletti.com/blog/2011/05/configuring-rails-3-https-ssl/
There are no actions passed to ssl_required. However I guess you want to add
def ssl_required?
true
end
to your controller so https is required for all actions by default.
The plugin API isn't obvious so look into the code.
Here is the solution.
Use
gem 'grosser-ssl_requirement', :require => 'ssl_requirement'
in you gemFile. Here is the gem guide
In your application controller:
include SslRequirement
ssl_required :all if ENV["RAILS_ENV"] == "production"
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.