我将一个简单的 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
我没有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
# ...
您可以在此处查看完整的源代码。
我怎么解决这个问题?感谢您的任何建议。