Skip to content

Commit c3865e2

Browse files
committed
Return 405s for root POSTs
1 parent b83dec7 commit c3865e2

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

app/controllers/errors_controller.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,8 @@ class ErrorsController < ActionController::Base
88
def not_found
99
render file: Rails.public_path.join("404.html"), status: :not_found
1010
end
11+
12+
def not_allowed
13+
head :method_not_allowed
14+
end
1115
end

config/routes.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
root "podcasts#index"
8181

8282
unless Rails.configuration.consider_all_requests_local
83+
match "/", via: :all, to: "errors#not_allowed"
8384
match "*unmatched", via: :all, to: "errors#not_found"
8485
end
8586
end

0 commit comments

Comments
 (0)