[erlang-questions] mod_esi should return 400 status for missing function

Steve Vinoski <>
Sat May 10 05:35:44 CEST 2008

On 5/9/08, Paul Fisher <> wrote:
> If a Module/Function request matching an erl_script_alias registration
>  does not exist as a function in the module registered, the current
>  implementation returns a "500 Internal Server Error", rather than a more
>  appropriate "400 Bad Request".

Sorry, but 400 is definitely not the right status code for this. The
HTTP spec defines 400 as follows:

"10.4.1 400 Bad Request

The request could not be understood by the server due to malformed
syntax. The client SHOULD NOT repeat the request without

In other words, 400 means the request from the client is syntactically
malformed, which does not apply in this case.

500 is the correct error to return for this case. The client is
apparently requesting a known and valid resource, but the server, due
to an incorrect configuration or implementation, is unable to fulfill
the request. The 500 HTTP status code is defined as follows:

"10.5.1 500 Internal Server Error

The server encountered an unexpected condition which prevented it from
fulfilling the request."

which is perfect and exactly right for this scenario.


More information about the erlang-questions mailing list