"502 Bad Gateway" when `respondHtml` endpoint misses parameter
kodeFant opened this issue · comments
When using respondHtml
, and a required param is not provided, something nasty happens to the nginx proxy on a production NixOS server.
Example:
action SomeAction =
let someParam = param @Text "someParam"
respondHtml [hsx|{someParam}|]
And then call http://siteUrl/SomeAction
directly without the required parameter.
I get an nginx 502 Bad Gateway
response which also takes the whole proxy down until systemd
automatically restarts it.
It leads to a couple of seconds of downtime, making it possible for any user to bring the server down.
I would expect the error to be properly catched with an IHP error, as it seems to be with the render
function (I think?).
The workaround would of course be to use paramOrNothing
, although a bit inconvenient to remember.
Some additional info provided on this issue: #1837