错误页面(500.html、404.html等)未在rails/jruby环境中呈现

发布于 2025-01-04 18:28:26 字数 427 浏览 2 评论 0原文

我对以下问题完全感到困惑:

  1. Rails 3.2 application on Tomcat with jruby 1.6.5.1
  2. 当触发错误时,(任何错误)页面最终超时,并显示“错误 101 (net::ERR_CONNECTION_RESET):连接已重置” ”。

我显然希望根据环境配置呈现堆栈跟踪或 public/500.html 。在 Mac 或 Windows 上进行本地开发时,该应用程序的执行完全符合我的预期。该应用程序部署到的 Tomcat 环境可能没有问题(我们以类似的配置运行数百个 Rails 应用程序)。

public/*.html 文件正在打包在 .war 文件中,以便按其应有的方式进行部署。

除了没有渲染错误之外,应用程序运行得很好。

我可以从哪里开始调试这个呢?

I'm completely baffled by the following issue:

  1. Rails 3.2 application on Tomcat with jruby 1.6.5.1
  2. When an error is triggered, (any error) the page eventually times out with "Error 101 (net::ERR_CONNECTION_RESET): The connection was reset."

I obviously expect either a stack trace or public/500.html to be rendered depending on the environment config. The application performs exactly as I expect when doing local development on Mac or Windows. The Tomcat environment this application gets deployed to is probably not at fault (we run hundreds of rails apps in similar configurations).

The public/*.html files are being packaged up in the .war file for deployment as they should be.

Other than not rendering errors, the application functions just fine.

Where can I even start debugging this one?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

红尘作伴 2025-01-11 18:28:26

修复方法是降级到 jruby-rack 版本 1.0.10,类似于此问题 我也回答了。 Tomcat 上最新版本的 jruby-rack 似乎存在多个问题。

The fix is to downgrade to jruby-rack version 1.0.10, similar to this issue which I also answered. It looks like there are multiple issues with the latest versions of jruby-rack on Tomcat.

梦中楼上月下 2025-01-11 18:28:26

该标志在 JRuby 1.7.26、Rails 3.0.20、Tomcat 8 / Java 8 上对我也不起作用:

config.consider_all_requests_local = true

我最终对 Rails 库进行了猴子修补。看来“request.local?”有一些有趣的地方。在 Tomcat 中运行时调用第 67 行 (actionpack/lib/action_dispatch/middleware/show_exceptions.rb)。

我将这一行从: 更改

if @consider_all_requests_local || request.local?

if @consider_all_requests_local

我这样做的原因是我只是在开发时手动设置考虑_all_request_local 标志,因此环回地址上的自动回退是没有意义的。

This flag was also not working for me on JRuby 1.7.26, Rails 3.0.20, Tomcat 8 / Java 8:

config.consider_all_requests_local = true

I ended up monkey patching the Rails library. It appears there is something funny with the 'request.local?' call on line 67 (actionpack/lib/action_dispatch/middleware/show_exceptions.rb) when running in Tomcat.

I changed this line from:

if @consider_all_requests_local || request.local?

to

if @consider_all_requests_local

My reasoning for doing this is I just set the consider_all_request_local flag manually when developing so the auto fallback on the loopback address is moot.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文