如何让 Rails、SSL 和 Apache 更好地发挥作用?

发布于 2024-10-12 14:01:44 字数 1357 浏览 1 评论 0原文

尝试让我的 Rails 应用程序使用 SSL 提交一些敏感表单数据,但运气不佳。基本问题是,一旦我提交表单(这是在 POST 请求上),它就会挂起一分钟,然后说服务器没有响应。

这是我正在使用的:

Apache 2.2.3 轨道2.3.8 RedHat Linux(Rackspace 服务器)

使用 ssl_requirement 插件,如下所示:

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

控制器 我想在操作上使用 SSL:

class RegistrationsController < ApplicationController
  ssl_required :create
  ...
end

我的 httpd.conf 包含此行来获取 ssl.conf:

Include conf.d/*.conf

以及我的 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>

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>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文