Ruby 在 Rails |被阻止的主机:localhost

Ruby On Rails | Blocked Host: localhost

我已经在这个问题上停留了几个小时,只是想找到这个问题的答案。

我从 Mac 终端 $ rails s 开始,它加载 puma 并且工作正常,直到我 运行 遇到下图中所附的问题。

你 运行 在 Rails 上的 Ruby 版本是在 2021 年 12 月 14 日下午发布的吗?比如 6.0.4.26.1.4.2,以及 7.0.0.rc2?

那么你应该只更新到晚上晚些时候发布的版本,因为这些版本在 default configuration

中有一个错误

There was a bug in the default configuration of the previous release such that requests in development with a port number wouldn’t be considered “authorized” requests. Requests to “localhost:3000” should work in this new version.

将 Rails 上的 Ruby 更新为这些版本 6.0.4.36.1.4.37.0.0.rc3 中的任何一个应该可以修复错误。


更新:版本 6.0.4.36.1.4.3 中存在 另一个 关于请求 [=18] 的错误=] 和自定义主机。因此,您需要更新到 2021-12-15 发布的 Rails 6.0.4.4 or 6.1.4.4 才能最终解决此问题。