-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
lib/api: Add /rest/noauth/health health-check (fixes #8430) #8585
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Added /rest/status as exception to the CSRF-token requirement and added a simple function to return a simple JSON object. The HTTP status gets send with per default
|
Please do provide an appropriate documentation PR for the API endpoint. We put in quite some work to get caught up and have them all documented, let's try to keep it complete. |
I will adjust the documentation and file a PR accordingly tomorrow. |
|
Our docker healthcheck is now using this endpoint #8640 |
With the no-auth API exception added in commit 7a40240 (PR syncthing#8585), we can extend that with a few more exceptions instead of restructuring the routing muxes and moving the static assets.
Purpose
Added a status page to the REST API which can act as a health-check, this allows third-party services and devices to check the status of Syncthing without having to use an API-key or plain-texted credentials.
To accomplish this two things were adjusted:
And obviously the /rest/status functionality was added, which is a simple return of a JSON object. Since, if you reach that point - it all goes well anyways. If not, you'll get another kind of error before reaching this point.
Testing
Two parts:
1.) Functional; visit the url and call the url in several ways, browser/curl/wget/...
2.) Security: Since we made an exception in the security-layer; hack-and-slash the URL a little to see if we don't unexpectedly reach other pages from this status-page while being unauthenticated.
Documentation
The API documentation will have to be updated to cover this addition.