Are you running on a Ruby on Rails version that was released on the afternoon of 2021-12-14 – like 6.0.4.2, 6.1.4.2, and 7.0.0.rc2?
Then you should just update to the versions released later in the night because those versions had a bug in their default configuration
There was a bug in the default configuration of the previous release such that requests in development with a port number wouldn’t be considered “authorized” requests. Requests to “localhost:3000” should work in this new version.
Updating Ruby on Rails to any of these versions 6.0.4.3, 6.1.4.3, and 7.0.0.rc3 should fix the bug.
Update: There was another bug in versions 6.0.4.3 and 6.1.4.3 regarding requests to 127.0.0.1:3000 and custom hosts. Therefore you need to update to Rails 6.0.4.4 or 6.1.4.4 which were released on 2021-12-15 to finally fix this issue.