CSRF(クロスサイトリクエストフォージェリ)とは
Webアプリケーションに存在する脆弱性、もしくはその脆弱性を利用した攻撃方法のことです。掲示板や問い合わせフォームなどを処理するWebアプリケーションが、本来拒否すべき他サイトからのリクエストを受信し処理してしまいます。
わかりやすい説明はこちら
ー 参考 外部からPOSTできない?RailsのCSRF対策をまとめてみた
https://qiita.com/KumatoraTiger/items/cc6a1107374cce500e6d
実際にCSRF(クロスサイトリクエストフォージェリ)対策を無効にする
development(検証環境)用
config
└── environments
└── development.rb <--ここ編集
# Use an evented file watcher to asynchronously detect changes in source code,
# routes, locales, etc. This feature depends on the listen gem.
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
config.action_controller.allow_forgery_protection = false #追記
production(本番環境) 用
config
└── environments
└── production.rb <--ここ編集
# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false
config.action_controller.allow_forgery_protection = false #追記
最後に DB migrate
データベースのマイグレーションを行います。
$ bundle exec rake db:migrate
アウトプット用で記事を参考にしながら書きました。