1

My servers are being hit by sporadic OPTIONS requests to my root path. These are all bots trying to find vulnerabilities. I want to return a 404 not found instead of raising an error, since my error tracking service is being hit all the time.

I have tried using:

options '/', to: 'application#return_not_found'

to route these requests properly, but Rails 5 gives me an error.

1 Answers1

2

According to this answer, you can use:

match '/' => 'application#return_not_found', via: :options

maxshelley
  • 166
  • 2
  • 5