Return a specific/200 status code for a particular URL prefix in Haproxy

This can be accomplished by using a lua response script. I already use one to set the CORS headers for the preflight response.

My rule is the following:

global
    ...
    lua-load /etc/haproxy/200.lua

frontend
    bind ...
    ...
    use_backend http_200 if ...

backend http_200
    http-request use-service lua.200-response

Lua script in /etc/haproxy/200.lua:

# 200.lua
core.register_service("200-response", "http", function(applet)
    local response = ""
    applet:set_status(200)
    applet:add_header("Content-Length", "0")
    applet:start_response()
    applet:send(response)
end)