Skip to content
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

Extend /api/status to support HEAD request #6145

Closed
kornicameister opened this issue Feb 7, 2016 · 6 comments
Closed

Extend /api/status to support HEAD request #6145

kornicameister opened this issue Feb 7, 2016 · 6 comments
Labels
release_note:enhancement Team:Operations Team label for Operations Team

Comments

@kornicameister
Copy link

I've been checking out Kibana status page recently and what I really missed was support for HEAD method for /api/status call. An idea would be to respond with OK code if overall status is green and with 503 if something is unavailable.

This issue is enhancement proposal.

@rashidkpc
Copy link
Contributor

Probably not something we'll add near term, but I'd take a pull for it.

@kornicameister
Copy link
Author

I guess it is not possible to complete. Looks like they have OPTIONS in favor of HEAD,
and actually adding HEAD as another method for already exiting route:

server.route({
    method: 'GET',
    path: '/api/status',
    handler: function (request, reply) {
      return reply({
        status: kbnServer.status.toJSON(),
        metrics: kbnServer.metrics
      });
    }
  });

results in error
FATAL [Error: Method name not allowed: HEAD /api/status]

However if you'd issued OPTIONS under /api/status it will work as long as kbn-version header is present in request. It looks a little weird, because GET works fine without that header whereas OPTIONS needs it.

Do you have any idea why that happens ?

@spalger
Copy link
Contributor

spalger commented Feb 15, 2016

Looks like hapi always uses GET handlers for HEAD requests. You would need to detect the method within the handler to see if it's a HEAD request, but that sounds dirty to me.

If all you're looking for is a 200/503 api I suggest sending HEAD request to /app/kibana (or whatever other apps you want to monitor).

If you want a simpler status API, I think an api like /api/status/{status_id}/{sub_property} might make sense. Though I don't really think it's the status API's job to convert red/green/yellow into status codes.

@kornicameister
Copy link
Author

@spalger, that is exactly what I've been doing :) (i.e. sending request to /app/kibana).
I think I am fine with what is already there and if adding some lean HTTP method to the content is not as straightforward as it initially seemed, maybe that's totally off the point.

@epixa epixa removed the P4 label Apr 25, 2017
@timroes timroes added the Team:Operations Team label for Operations Team label Aug 13, 2018
@timroes
Copy link
Contributor

timroes commented Aug 13, 2018

cc @elastic/kibana-operations

@tylersmalley
Copy link
Contributor

Closing this in favor of creating a new endpoint for this purpose which is tracked here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:enhancement Team:Operations Team label for Operations Team
Projects
None yet
Development

No branches or pull requests

6 participants