简体   繁体   English

如何使Rails,SSL和Apache发挥出色?

[英]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. 试图让我的Rails应用程序使用SSL提交一些敏感的表单数据,而没有太多的运气。 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. 基本问题是,一旦我提交了一个表单(这是在POST请求中),它就会挂起一分钟,然后说服务器没有响应。

Here's what I'm working with: 这是我正在使用的:

Apache 2.2.3 Rails 2.3.8 RedHat Linux (Rackspace server) Apache 2.2.3 Rails 2.3.8 RedHat Linux(机架空间服务器)

Using the ssl_requirement plugin as follows: 如下使用ssl_requirement插件:

ApplicationController: 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: 我想在操作上使用SSL的控制器:

class RegistrationsController < ApplicationController
  ssl_required :create
  ...
end

My httpd.conf includes this line to grab ssl.conf: 我的httpd.conf包含以下一行以获取ssl.conf:

Include conf.d/*.conf

And my SSL VHost (in the conf.d/ssl.conf file) looks like this: 我的SSL VHost(在conf.d / ssl.conf文件中)如下所示:

<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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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