httphttp-status-codeshttp-options-method

Can an HTTP OPTIONS request return a 204 or should it always return 200?


According to https://www.rfc-editor.org/rfc/rfc9110.html#name-options the only response ever mentioned regarding an HTTP OPTIONS request is a 200. However, there seem to be cases such as when the content-length is 0 that a 204 would be more appropriate. Is it appropriate for an HTTP OPTIONS request to return a 204?


Solution

  • Yes, it can return 204. Or 400. Or 404. There is no general restriction as to what status codes a method can return.

    Also note that it's time to stop looking at RFC 2616. See https://httpwg.org/.