[英]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>
This is what I have done, and it works great (although this is OS X, not Linux) 这就是我所做的,并且效果很好(尽管这是OS X,而不是Linux)
http://web.archive.org/web/20120919184321/http://shiningthrough.co.uk/Setting-up-an-SSL-enabled-Apache-development-server-using-Phusion-Passenger-on-OS-X-Snow-Leopard http://web.archive.org/web/20120919184321/http://shiningthrough.co.uk/Setting-up-an-SSL-enabled-Apache-development-server-using-Phusion-Passenger-on-OS- X-雪豹
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.