0

I just started getting errors in my logs:

ActionController::RoutingError: No route matches [HEAD] "/auth/cas" 

There is most definitely a route for "/auth/cas" (although it's buried in a gem) but not for a HEAD request. These errors coincide with UptimeRobot.com hitting my server, but it appears that they just started using HEAD requests, because I wasn't getting these when I originally set up my account with them.

Since I can't change the way UptimeRobot works, and I don't want to find a different service, how can I create a route that will handle this request or otherwise make it go away?

There's nothing in the Rails routing guide about how to handle HEAD requests.

2
  • Just use another route / URL for uptime monitoring. One that's under your control and not "buried in a gem". Commented Nov 3, 2021 at 9:49
  • The uptime monitor is being redirected to an authentication page, and (apparently) instead of GETting it, it is first HEADing it. All URLs require authentication. I wanted to create a "heartbeat" page that didn't require authentication but the powers that be decided that wasn't worth my time—even though you and I know it's very little time, it just SOUNDED like too much work to them, and they want FEATURES DAMMIT—so I'm looking for a faster solution. Commented Nov 3, 2021 at 19:24

1 Answer 1

1

Rails does not have a built in head routing helper. But you can define a route that maches any HTTP method imaginable with the match method that they use under the cover:

match "/auth/cas", to: "foos#bar", via: :head 
Sign up to request clarification or add additional context in comments.

1 Comment

Adding head and options would make a nice PR though.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.