Healthcheck failing - Ruby on Rails
project_id: 5e48166f-cb79-4848-9877-759ac3af182f
Hey there 👋,
My Rails application deployment fails when the healthcheck path is supplied, however if I remove it and deploy - when I curl or access the path post-deployment there appears to be no issues.
There appears no errors or failures during the deploy.
====================== SOLVED ======================
You need to exclude your health check path from your enforced SSL paths, see the below rails docs:
https://edgeapi.rubyonrails.org/classes/ActionDispatch/SSL.html
Which will tell you to do this if that link is broken:
Solution:Jump to solution
Hello future traveller. If you find your Ruby on Rails application failing your health check, remember to exclude your healthcheck path from your enforced SSL paths, see the below rails docs:
https://edgeapi.rubyonrails.org/classes/ActionDispatch/SSL.html
Which will tell you to put something like this in your environment file (e.g. production.rb) if that link is broken:
...
15 Replies
Project ID:
5e48166f-cb79-4848-9877-759ac3af182f
can you show me what you have set the path to?
I should mention that I have tried both 'up' and '/up'. Neither appears to work
In my rails routes, the path is set as so:
get "up" => "rails/health#show", :as => :rails_health_check
In Railway, I'm primarily setting it to '/up'any idea why your app is returning a 404?
what do the deploy logs look like?
Not sure, when I remove the healthcheck path and do a normal deploy, that path seems perfectly accessible (see the screenshot of the browser). The deploy logs show no sign the requests are even hitting the server
have you enabled access logging?
My log level in Rails is set to 'info' which means that access requests are logged. Here's a screenshot of me accessing the endpoint when health checks are disabled.
do you have some middleware that drops requests that arent from the domain? because the health check is done internally from a local ip address like 192.168.0.102 or 10.0.0.102
Hmm an interesting thought. It's a pretty stock-standard rails app - so I don't have anything too fancy. I do enforce access over SSL, and have a middleware that allows clients to pass a header requesting for a response format, but it doesn't require that header. I'll try turning off force SSL and my header middleware and will retry a deploy.
oh yeah definitely don’t want that stuff for a health check, especially the force ssl, as railway forces ssl for all public access
Nice, that did the trick! I'll confirm whether it was the enforcing of SSL or my header middleware and will get back to this thread with the answer. Will get you a coffee in the meantime
thank you so much!
Solution
Hello future traveller. If you find your Ruby on Rails application failing your health check, remember to exclude your healthcheck path from your enforced SSL paths, see the below rails docs:
https://edgeapi.rubyonrails.org/classes/ActionDispatch/SSL.html
Which will tell you to put something like this in your environment file (e.g. production.rb) if that link is broken:
awsome thank you!!