Skip to content

Instantly share code, notes, and snippets.

@cirocosta
Last active January 8, 2022 17:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cirocosta/ccd317490f9e9c0ade878e89ea8591ab to your computer and use it in GitHub Desktop.
Save cirocosta/ccd317490f9e9c0ade878e89ea8591ab to your computer and use it in GitHub Desktop.
Returns a 200OK as a status check (haproxy)
status = {}
status.version = "0.0.1"
status.startup = function()
core.Info("[status] status script v" .. status.version);
end
status.run = function(applet)
local response = "200 OK"
local response_length = string.len(response)
applet:set_status(200)
applet:add_header("Content-Length", response_length)
applet:add_header("Content-Type", "text/plain")
applet:start_response()
applet:send(response)
end
core.register_init(status.startup)
core.register_service("status", "http", status.run)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment