将 Rails 升级到 6,出现阻塞主机错误 [英] Upgraded Rails to 6, getting Blocked host Error

查看:44
本文介绍了将 Rails 升级到 6,出现阻塞主机错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要 ActiveStorage 中的新函数来 resize_to_fill,所以我升级到 Ruby 2.5.1 和 Rails 6.

I needed the new function in ActiveStorage to resize_to_fill so I upgraded to Ruby 2.5.1 and Rails 6.

ruby '2.5.1'

gem "rails", github: "rails/rails"

当我停止,然后启动我的服务器 (Cloud 9) 时,我收到 Rails 错误:

When I stopped, then started my server (Cloud 9), I received the Rails error:

被阻止的主机:xxxxxxx-xxxxxxx.c9users.io允许对xxxxxxx-xxxxxxx.c9users.io的请求,添加如下配置:

Blocked host: xxxxxxx-xxxxxxx.c9users.io To allow requests to xxxxxxx-xxxxxxx.c9users.io, add the following configuration:

Rails.application.config.hosts

"xxxxxxx-xxxxxxx.c9users.io"

Rails.application.config.hosts << "xxxxxxx-xxxxxxx.c9users.io"

我试过重新启动,新窗口,但没有什么能摆脱这个.我以前从未见过这个错误.我猜新版本的 Rails 正在做些什么?

I've tried restarting, new windows, but nothing gets rid of this. I've never seen this error before. I'm guessing the new version of Rails is doing something?

推荐答案

我添加了 Rails.application.config.hosts <<xxxxxxx-xxxxxxx.c9users.io"config/application.rb 并且它修复了我的测试应用程序.然后我对我的真实应用程序做了它,它也有效.问题是,Devise 也抛出了一个错误,这显然至少要到 Rails 6 beta 才能修复.我想我会回到 Carrierwave 来满足我的图像大小需求,直到 ActiveStorage 更加成熟.

I added Rails.application.config.hosts << "xxxxxxx-xxxxxxx.c9users.io" to config/application.rb and it fixed my test app fine. Then I did it to my real app and it also worked. The problem is, Devise threw an error as well, which apparently won't be fixed until at least Rails 6 beta. I guess I'm going back to Carrierwave for my image sizing needs until ActiveStorage is more mature.

这篇关于将 Rails 升级到 6,出现阻塞主机错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆