phi*_*kim 3 ruby rack sinatra paas
我上传了一个简单的Sinatra应用程序到AppFog.它在我的本地机器上运行良好.但在将应用程序上传到AppFog后,当我访问AppFog域时,会显示带有"禁止"消息的页面.
这些是appFog日志:
====> /logs/stderr.log <====
...
W, [2012-06-01T06:32:54.008426 #28933] WARN -- : attack prevented by Rack::Protection::IPSpoofing
211.32.146.42 - - [01/Jun/2012 06:32:54] "GET / HTTP/1.1" 403 - 0.0002
10.0.64.157 - - [01/Jun/2012:06:32:54 UTC] "GET / HTTP/1.0" 403 9 - -> /
W, [2012-06-01T06:32:54.393022 #28933] WARN -- : attack prevented by Rack::Protection::IPSpoofing
211.32.146.42 - - [01/Jun/2012 06:32:54] "GET /favicon.ico HTTP/1.1" 403 - 0.0002
10.0.64.157 - - [01/Jun/2012:06:32:54 UTC] "GET /favicon.ico HTTP/1.0" 403 9 - -> /favicon.ico
Run Code Online (Sandbox Code Playgroud)
我没有Rack::Protection::IPSpoofing在我的代码中使用,但我得到了这些错误.Rack::Utils用于帮助程序块.这是导致问题吗?
我写的唯一Ruby代码如下:
require 'sinatra'
require 'data_mapper'
require 'builder'
require 'sinatra/flash'
require 'sinatra/redirect_with_flash'
require 'haml'
enable :sessions
SITE_TITLE = "Recall"
SITE_DESCRIPTION = "'cause you're too busy to remember"
DataMapper::setup(:default, "sqlite3://#{Dir.pwd}/recall.db")
class Note
include DataMapper::Resource
property :id, Serial
property :content, Text, :required => true
property :complete, Boolean, :required => true, :default => false
property :created_at, DateTime
property :updated_at, DateTime
end
DataMapper.finalize.auto_upgrade!
helpers do
include Rack::Utils
alias_method :h, :escape_html
end
get '/' do
@notes = Note.all :order => :id.desc
@title = 'All Notes'
if @notes.empty?
flash[:error] = 'No notes found. Add your first below.'
end
haml :home
end
# ...
Run Code Online (Sandbox Code Playgroud)
您可以在这里查看完整的源代码.
我怎么解决这个问题?感谢您的任何建议.
小智 5
这是一个简单的修复,尝试添加这个:
set :protection, :except => :ip_spoofing
Run Code Online (Sandbox Code Playgroud)
我们正在修补我们的nginx以解决这个问题,但这项工作现在将有所帮助.
| 归档时间: |
|
| 查看次数: |
873 次 |
| 最近记录: |