#58773·rails

InvalidAuthenticityToken / HTTP 500 error on newly created views immediately after 'rails new' on 8.1.

Author: naldiocjCreated Sep 15, 2026Updated Sep 15, 2026

Steps to reproduce

  1. Generate a brand new Rails application using: rails new my_app --version=8.1.3.1
  2. Start the local development server using rails server.
  3. Open http://localhost:3000 in the browser.
# The application crashes immediately upon rendering the default welcome layout.
# An unhandled InvalidAuthenticityToken / CSRF exception is triggered during the initial request.

Expected behavior

The default Rails welcome page or basic generated scaffold views should render seamlessly without throwing an unhandled authenticity token/CSRF internal server error right out of the box.

Actual behavior

The application immediately crashes with an HTTP 500 Internal Server Error when evaluating the default layout containing <%= csrf_meta_tags %> and <%= csp_meta_tag %>.

System configuration

Rails version: 8.1.3.1

Ruby version: ruby 3.4.10 (2026-06-30 revision 2b0b7728dc) +PRISM [x86_64-linux]