What Is a 415 Status Code?

The origin server is refusing to service the request because the payload is in a format not supported by this method on the target resource.

The format problem might be due to the request’s indicated Content-Type or Content-Encoding, or as a result of inspecting the data directly.


415 CODE REFERENCES

Rails HTTP Status Symbol :unsupported_media_type

Go HTTP Status Constant http.StatusUnsupportedMediaType

Symfony HTTP Status Constant Response::HTTP_UNSUPPORTED_MEDIA_TYPE

Python2 HTTP Status Constant httplib.UNSUPPORTED_MEDIA_TYPE

Python3+ HTTP Status Constant http.client.UNSUPPORTED_MEDIA_TYPE

Python3.5+ HTTP Status Constant http.HTTPStatus.UNSUPPORTED_MEDIA_TYPE

Why does the 415 status code happen?

When an HTTP 415 status code appears, it means that the server refused to accept a request from the browser. This error code usually happens because the payload (what the browser sends) isn’t in the right format.

It can also occur due to Content-Type and Content-Encoding headers being rejected by the server. In some cases, the server may return this error when it further inspects the message body.

In other words, the 415 Unsupported Media Type error informs you that the server won’t accept a file type because it doesn’t support the payload. This usually indicates that there is an underlying issue with the PHP code.

How to fix a 415 status code error

Wondering how to fix a 415 Unsupported Media Type error? We’ve got you covered.

It’s important to keep in mind that fixing a 415 error will involve having some coding experience. If you discover this status code error, you’ll want to:

  • Make sure you send the right Content-Type header value
  • Ensure the server can process the Content-Type header
  • Double check what your server can process using the Accept header

Will search engines index a URL with a 415 Unsupported Media Type status code?

It’s important to note that search engines like Google will likely not index URLs with a 415 error. As a result, any web pages returning this error could suffer a loss in rankings in the search results.

415 status code example

Want to see what an HTTP 415 error code look like in action? In this example, a client wants to request a gif file, but the server only accepts PNG files.

Initial request

POST /blog/ HTTP/1.1

Host: www.example.com

Content-Type: gif

Content-Length: 15

Initial response

HTTP/1.1 415 Unsupported Media Type

Content-Type: text

Content-Length: 130

<html>

<head>

<title> Unsupported format </title>

</head>

<body>

<p> This media type is not supported </p>

</body>

</html>

Additional resources


Return to List of HTTP Status Codes

TO TOP