Software⏱️ 3 min read📅 2026-06-04

How to Fix: Upgraded Rails to 6, getting Blocked host Error

Rails 6 upgrade issue with blocked host error.

Quick Answer: Try adding the specific IP address to the Rails.application.config.hosts array in your application's configuration file.

The 'Blocked host' error occurs when the Rails application is unable to connect to a specific host, in this case, your Cloud 9 server (xxxxxxx-xxxxxxx.c9users.io). This issue affects users who have upgraded their Ruby and Rails versions, specifically those using ActiveStorage's resize_to_fill feature.

This error can be frustrating as it prevents the application from functioning properly. Fortunately, there are steps you can take to resolve this issue.

🔍 Why This Happens

  • The primary reason for this error is that Cloud 9 servers have a limited number of allowed hosts. When you upgraded your Rails version, the new host was not added to the list of allowed hosts. This causes the 'Blocked host' error.
  • An alternative reason could be that there are issues with your server configuration or firewall settings, which may be blocking the connection to your Cloud 9 server.

🚀 How to Resolve This Issue

Adding hosts to Rails.application.config

  1. Step 1: Open your Rails application's configuration file (usually config/environments/*.rb) and add the following line under Rails.application.config.hosts: Rails.application.config.hosts << 'xxxxxxx-xxxxxxx.c9users.io'
  2. Step 2: Save the changes to the configuration file and restart your server. This should allow the connection to your Cloud 9 server.
  3. Step 3: Verify that the error has been resolved by checking the Rails logs for any further errors.

Checking server configuration and firewall settings

  1. Step 1: Check your server's configuration files (usually /etc/nginx/nginx.conf or /etc/ssh/sshd_config) to ensure that they are not blocking incoming connections on the specified host.
  2. Step 2: Verify that your firewall settings are allowing traffic on the required port (usually 80 for HTTP or 443 for HTTPS). You may need to add rules to your firewall configuration file to allow connections to your Cloud 9 server.

🎯 Final Words

To resolve the 'Blocked host' error when upgrading to Rails 6, you can try adding the new host to your Rails application's configuration file or checking your server configuration and firewall settings. If none of these steps resolve the issue, it may be worth reaching out to Cloud 9 support for further assistance.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions