最近我收到了关于ruby on rails的错误,但不知道它意味着什么。任何帮助都很受欢迎!
ERROR: Failed to generate exception summary:
ActionView::Template::Error: IP spoofing attack?! HTTP_CLIENT_IP="172.17.3.20" HTTP_X_FORWARDED_FOR="79.170.168.251"
修改
我在application controller
before_filter :ensure_domain
APP_DOMAIN = 'www.mysite.com'
def ensure_domain
if request.env['HTTP_HOST'] != APP_DOMAIN && Rails.env.production?
#HTTP 301 is a "permanent" redirect
redirect_to "https://#{APP_DOMAIN}#{request.path}", :status => 301
end
end
答案 0 :(得分:1)
除非你实际上在进行基于IP的授权,否则你可能会忽略这一点。此消息告诉您的所有内容是请求来自的IP与HTTP_X_FORWARDED_FOR
标头中传递的IP不同,这并不一定意味着它是'一个恶搞。这有很多正当理由,因此通过设置config.action_dispatch.ip_spoofing_check = false