简体   繁体   中英

How do I get Rails, SSL and Apache to play nice?

Trying to get my Rails app submitting some sensitive form data with SSL and not having too much luck. The basic problem is that once I submit a form (this is on a POST request), it just hangs for a minute and then says the server is not responding.

Here's what I'm working with:

Apache 2.2.3 Rails 2.3.8 RedHat Linux (Rackspace server)

Using the ssl_requirement plugin as follows:

ApplicationController:

class ApplicationController < ActionController::Base
  include SslRequirement
  helper :all # include all helpers, all the time
  protect_from_forgery # See ActionController::RequestForgeryProtection for details

  # Scrub sensitive parameters from your log
  filter_parameter_logging :password
end

Controller I want to use SSL on an Action:

class RegistrationsController < ApplicationController
  ssl_required :create
  ...
end

My httpd.conf includes this line to grab ssl.conf:

Include conf.d/*.conf

And my SSL VHost (in the conf.d/ssl.conf file) looks like this:

<VirtualHost XXX.XXX.XXX.XXX:443>
   ServerName www.nameofmyapp.com
   ServerAlias nameofmyapp.com
   DocumentRoot /var/www/apps/myapp/current/public
   RailsEnv production
   RequestHeader set X_FORWARDED_PROTO 'https'
   SSLEngine on
   SSLCertificateFile /etc/pki/tls/certs/2012-nameofmyapp.com.crt
   SSLCertificateKeyFile /etc/pki/tls/private/2012-nameofmyapp.com.key
   SSLCACertificateFile /etc/pki/tls/certs/SecureSite_Bundle.pem
</VirtualHost>

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