简体   繁体   English

Heroku上的Delayed_Job显示“禁止”错误

[英]Delayed_Job on Heroku showing “Forbidden” error

I am using delayed_job gem on a heroku deployment. 我在heroku部署中使用了delay_job gem。 It has been working fine for a few months, but suddenly when I try to access to access mydomain.com/delayed_job it shows one word: "Forbidden" 它已经工作了好几个月,但是突然间,当我尝试访问mydomain.com/delayed_job时,它显示了一个词:“禁止访问”

When I check heroku logs it doesn't show an error, but does show that the page was requested. 当我检查heroku日志时,它没有显示错误,但确实显示了请求页面。

Any idea why this would happen? 知道为什么会这样吗? It is especially confusing since it has been working fine until now. 到目前为止,它一直运行良好,尤其令人困惑。

In the end I tried accessing the same page in a different browser and it works. 最后,我尝试在不同的浏览器中访问相同的页面,并且可以正常工作。 Therefore the error likely has something to do with the local browser cache. 因此,该错误可能与本地浏览器缓存有关。

I had this too; 我也有这个 it seems to be similar to the problem described in this issue . 它似乎类似于本期中描述的问题 The CSRF protection gets false positives. CSRF保护得到误报。

In my case, I only use DelayedWebAdmin in development, so I created an initializer to disable session protection. 就我而言,我仅在开发中使用DelayedWebAdmin,因此我创建了一个初始化程序来禁用会话保护。 This would probably be a bad idea in production, but here's how to disable it in development: 这在生产中可能不是一个好主意,但是下面是在开发中禁用它的方法:

config/initializers/delayed_job_web.rb : config/initializers/delayed_job_web.rb

if Rails.env.development?
    class DelayedJobWeb
        disable :sessions
        set :protection, false
    end
end

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM