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

"502 Bad Gateway" when respondHtml endpoint misses parameter #1841

Open
kodeFant opened this issue Oct 10, 2023 · 0 comments
Open

"502 Bad Gateway" when respondHtml endpoint misses parameter #1841

kodeFant opened this issue Oct 10, 2023 · 0 comments

Comments

@kodeFant
Copy link
Contributor

kodeFant commented Oct 10, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant