Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ssl/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 3 如何创建安全控制器_Ruby On Rails 3_Ssl - Fatal编程技术网

Ruby on rails 3 如何创建安全控制器

Ruby on rails 3 如何创建安全控制器,ruby-on-rails-3,ssl,Ruby On Rails 3,Ssl,我不熟悉rails。我想创建安全控制。 这里是我所做的: 我创建了一个安全的,并将routes.rb更改为 scope :constraints => {:protocol => 'https'} do get "secure/index" end 但是,我有这个错误 [2012-10-08 12:07:07]错误错误URI\x12p\x00\x00H\x00��'. 错误错误URIpqn���|�լ%[�Y���\x00\x00H\x00��'. 当我请求https://

我不熟悉rails。我想创建安全控制。

这里是我所做的:
我创建了一个安全的,并将routes.rb更改为

scope :constraints => {:protocol => 'https'} do
  get "secure/index"
end  
但是,我有这个错误

[2012-10-08 12:07:07]错误错误URI
\x12p\x00\x00H\x00��'.
错误错误URI
pqn���|�լ%[�Y���\x00\x00H\x00��'.

当我请求
https://localhost:3000/secure


thanx.

我认为您对安全http通信有误解

http和https是两种不同的东西。这就是为什么它们通常在两个不同的端口上工作!http是80,https通常是443

https需要一个签名证书,通常由您的Web服务器(apache、nginx等)处理。还可以在rails中处理https内容,并且有一些很好的技巧可以处理配置ssl强制


请看这篇文章开始:

thanx,谢谢您的回复。我将更改服务器配置以服务sslAs@phoet说我误解了我的要求。并在博客文章中找到了我问题的答案。