Skip to content

Add health-checking endpoint on '/' that always returns 200 #2992

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

Merged
merged 3 commits into from
Nov 3, 2016

Conversation

woyorus
Copy link
Contributor

@woyorus woyorus commented Nov 2, 2016

At some point people may need to have an endpoint that simply responds 200 OK without any authentication. In our case, we need it for L7 GSLB health-checker, as we cannot pass any custom auth headers.

This PR would make parse to always respond with 200 and text "Ok" on path /.

@flovilmart
Copy link
Contributor

We needed a health check endpoint that returns 200 for Google Cloud L7 load balancers and they don't support request headers....

@TylerBrock
Copy link
Contributor

Thank you, I love this. We wound up adding a similar route in our index.js for our docker containers.

It would be nice if everyone could take advantage by making this part of parse-server as a whole and not just the CLI. Want to add it to src/ParseServer.js ? Something like:

api.get('/', (req, res) => res.sendStatus(200))

@woyorus
Copy link
Contributor Author

woyorus commented Nov 2, 2016

Hi Tyler, thank you. I would love to do that! Will make that change tonight.

@facebook-github-bot
Copy link

@woyorus updated the pull request - view changes

@woyorus
Copy link
Contributor Author

woyorus commented Nov 2, 2016

Something like that? I am not exactly sure if the location for the tests is correct.

@TylerBrock
Copy link
Contributor

TylerBrock commented Nov 3, 2016

Looks like there are two copies of the same test, I'd pick the one outside of the PublicAPI test suite.

Also, I'm also not sure what the best place for that test would be, since there is nothing else quite like it. Maybe index.spec.js would be better?

@flovilmart
Copy link
Contributor

Yeah, the location of the test is not much big of a deal IMHO, duplication however :)

@facebook-github-bot
Copy link

@woyorus updated the pull request - view changes

@woyorus
Copy link
Contributor Author

woyorus commented Nov 3, 2016

Yes you're right. I've introduced duplication because I've seen a reconfigureServer() call in beforeEach in one block, and no such thing in another. So I've attempted to test for both 'configurations'.

However both tests are placed to PublicAPI test suite, but it looks like I've found a better place for that, in index.spec.js

@flovilmart
Copy link
Contributor

Waiting for Travis then merging! And releasing a beta :)

@TylerBrock
Copy link
Contributor

Nice, thanks @woyorus

@flovilmart flovilmart merged commit 908c480 into parse-community:master Nov 3, 2016
@gateway
Copy link

gateway commented Nov 3, 2016

Thanks for this, I can use NewRelic to also monitor a URL now.. btw prob should write a small doc for people on this feature.. cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants