質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Ruby on Rails 6

Ruby on Rails 6は、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Q&A

0回答

265閲覧

RailsをAWS Cloud9にて、Preview Runningしたのですが、Blocked Host:"ホスト名"という警告が出てしまいます。

ym1111

総合スコア16

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Ruby on Rails 6

Ruby on Rails 6は、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

0グッド

0クリップ

投稿2020/09/07 05:55

Rails Tutorialを参考に、AWS Cloud9にてRailsを動かしてたのですが、「Blocked host: ホスト名、To allow requests to ホスト名, add the following to your environment configuration:」
という警告が出てしまいます。
コードはGemFileはチュートリアル通り、以下のようにしました。

Ruby

1source 'https://rubygems.org' 2git_source(:github) { |repo| "https://github.com/#{repo}.git" } 3 4gem 'rails', '6.0.3' 5gem 'puma', '4.3.4' 6gem 'sass-rails', '5.1.0' 7gem 'webpacker', '4.0.7' 8gem 'turbolinks', '5.2.0' 9gem 'jbuilder', '2.9.1' 10gem 'bootsnap', '1.4.5', require: false 11 12group :development, :test do 13 gem 'sqlite3', '1.4.1' 14 gem 'byebug', '11.0.1', platforms: [:mri, :mingw, :x64_mingw] 15end 16 17group :development do 18 gem 'web-console', '4.0.1' 19 gem 'listen', '3.1.5' 20 gem 'spring', '2.1.0' 21 gem 'spring-watcher-listen', '2.0.1' 22end 23 24group :test do 25 gem 'capybara', '3.28.0' 26 gem 'selenium-webdriver', '3.142.4' 27 gem 'webdrivers', '4.1.2' 28end 29gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

development.rbというファイルは以下のように、デフォルトのコードに、最後の一行のみ加えました。

Ruby

1Rails.application.configure do 2 # Settings specified here will take precedence over those in config/application.rb. 3 4 # In the development environment your application's code is reloaded on 5 # every request. This slows down response time but is perfect for development 6 # since you don't have to restart the web server when you make code changes. 7 config.cache_classes = false 8 9 # Do not eager load code on boot. 10 config.eager_load = false 11 12 # Show full error reports. 13 config.consider_all_requests_local = true 14 15 # Enable/disable caching. By default caching is disabled. 16 # Run rails dev:cache to toggle caching. 17 if Rails.root.join('tmp', 'caching-dev.txt').exist? 18 config.action_controller.perform_caching = true 19 config.action_controller.enable_fragment_cache_logging = true 20 21 config.cache_store = :memory_store 22 config.public_file_server.headers = { 23 'Cache-Control' => "public, max-age=#{2.days.to_i}" 24 } 25 else 26 config.action_controller.perform_caching = false 27 28 config.cache_store = :null_store 29 end 30 31 # Store uploaded files on the local file system (see config/storage.yml for options). 32 config.active_storage.service = :local 33 34 # Don't care if the mailer can't send. 35 config.action_mailer.raise_delivery_errors = false 36 37 config.action_mailer.perform_caching = false 38 39 # Print deprecation notices to the Rails logger. 40 config.active_support.deprecation = :log 41 42 # Raise an error on page load if there are pending migrations. 43 config.active_record.migration_error = :page_load 44 45 # Highlight code that triggered database queries in logs. 46 config.active_record.verbose_query_logs = true 47 48 # Debug mode disables concatenation and preprocessing of assets. 49 # This option may cause significant delays in view rendering with a large 50 # number of complex assets. 51 config.assets.debug = true 52 53 # Suppress logger output for asset requests. 54 config.assets.quiet = true 55 56 # Raises error for missing translations. 57 # config.action_view.raise_on_missing_translations = true 58 59 # Use an evented file watcher to asynchronously detect changes in source code, 60 # routes, locales, etc. This feature depends on the listen gem. 61 config.file_watcher = ActiveSupport::EventedFileUpdateChecker 62 63 #Allow connections to local server. 64 config.hosts << "ホスト名" 65end

なお、ホスト名は、自分のサーバーのホスト名を打っているとします。

試したこととしては、警告の指示通り、config.hosts << "ホスト名"と打ったこと,
config.hosts.clearと打ちましたが、依然として警告が出てしまいます。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問