cortex icon indicating copy to clipboard operation
cortex copied to clipboard

Restrict /flush and /shutdown ingester endpoints to POST method only

Open pracucci opened this issue 3 years ago • 4 comments

As discussed in https://github.com/cortexproject/cortex/pull/3228#discussion_r493859743, we should restrict /flush and /shutdown ingester endpoints to POST HTTP method only.

When doing it we should also:

  1. Make it clear in the / page that they're POST only (because if you will click these links from the browser, it will show a 405 error)
  2. Change tools/migrate-ingester-statefulsets.sh because calls GET /shutdown, but then we would have to use something different than wget (and curl is not available in Cortex images)

pracucci avatar Sep 25 '20 15:09 pracucci

Should we add a button on the page instead of the link?

roidelapluie avatar Oct 02 '20 16:10 roidelapluie

Button sounds good to me. It may need some changes to “IndexPage” code.

pstibrany avatar Oct 02 '20 17:10 pstibrany

Change tools/migrate-ingester-statefulsets.sh because calls GET /shutdown, but then we would have to use something different than wget (and curl is not available in Cortex images)

I think I had my mind turned off when I wrote this. We don't run the script from the Cortex image. We can just replace it with curl -X POST.

pracucci avatar Oct 03 '20 08:10 pracucci

I think I had my mind turned off when I wrote this. We don't run the script from the Cortex image. We can just replace it with curl -X POST.

We can run curl from machine that runs the script, but then we need to deal with background port forwarding and possible port collisions. When I tried that, port forward sometimes took longer to setup, so curl failed. In the end I chose to run “wget” from within the container instead, which doesn’t have these problems.

pstibrany avatar Oct 03 '20 09:10 pstibrany