MSIE / Edge uses HTTP HEAD for <object> data URLs and then treats 204 response as an error?

Background:

My PHP code handles typical HTTP HEAD requests, sending either an HTTP status 404 response or an HTTP 204 response. This seems correct to me, since RFC7231 indicates an HTTP 204 status as:

6.3.5. 204 No Content

A status code of 204 (without content) indicates that the server has successfully completed the request and that there is no additional content to send the response payload to the body. The metadata in the response header fields refers to the target resource and its selected representation after applying the requested action ...

Answer 204 allows the server to indicate that the action was successfully applied to the target resource, while implying that the user agent does not need to switch from the current “document view” (if any) ...

Answer 204 ends with the first empty line after the header fields, because it cannot contain the body of the message ...

https://tools.ietf.org/html/rfc7231#section-6.3.5

Since the user agent only requests the headers, not the file itself, 204 seems to work.

Surprise number 1:

<object> URL- , MSIE/Edge HTTP HEAD, . MS , . HEAD, HTTP GET .

, ...

№2:

MSIE/Edge 204 HEAD, .

, , ( ).

204? , , ... .

+4
2

204 HEAD, -, GET, 204, , , . GET, HEAD .

GET 200, HEAD 200.

+4

Source: https://habr.com/ru/post/1651316/


All Articles