PDF download Download Article
Why you are getting this error, what to do about it
PDF download Download Article

The 415 error, or "Unsupported Media Type" error, occurs when a file format is sent in a request that the server doesn't recognize or isn't configured to handle. This is generally a server-side issue that occurs when you are using an API (Application Program Interface). This guide teaches you the causes of this error and how to fix it.

415 Unsupported Media Type Error

A 415 error occurs when the server doesn't recognize the file format in a request. Check the "Content-Type" and "Content-Encoding," headers, as well as the "Accept" headers on the client side. Check the syntax for typos.

Section 1 of 2:

What Causes the Error

PDF download Download Article
  1. If the content in the request does not match the "Content-Type" header, it may return a 415 error code. The client needs to ensure the "Content-Type" header correctly identifies the file type or media file being sent. Fixing this error may require some coding skills.
  2. The server may not be configured to handle the file type that is being sent in the request. You may need to adjust your server or application settings to allow it to accept the files that are being sent.
    Advertisement
  3. This lists all the ways that data may be compressed or packaged so that the server knows how to unpack the data. If the "Content-Encoding" header is incorrect, it will return a 415 error. [1]
  4. This is a problem on the client side. If the client has a missing "Accept" header or it specifies a media type that the server can't process and return, you will receive a 415 error.
  5. Advertisement
Section 2 of 2:

How to Fix the Error

PDF download Download Article
  1. You can either check the server logs or use the developer tools in a web browser to check the "Content-Type" headers and the file type that is being sent in the failing requests. You can also use a tool like Sitechecker.pro to check your code.
  2. Check that the "Content-Type" headers in your request are correct. For example, if you are sending a JSON file, the header should read "Content-Type: application/json;" If it is an image file, the header should read something like "Content-Type: image/jpeg;". If it is a text or HTML file, the header should read "Content-Type: text/html; charset=UTF-8;".
  3. Make sure your request script isn't missing the "Content-Encoding" headers. Make sure they have the correct encoding (i.e., "gzip", "br").
  4. Ensure there are no typos in your script on the client or server side. For example, if the header reads "charset=UTF8" instead of "charset=UTF-8", this could cause a 415 error. It could be something as simple as using the tag "header" instead of "headers" in your script.
  5. Your server may not be configured to accept the requested file format. You may need to adjust your server configuration to allow it to accept the file format or encoding. If it's an encoding problem, you may need to add or adjust your gzip directives or enable specific modules, such as mod_deflate. [2]
  6. If you are using a web application, a CMS such as WordPress , a plug-in or WordPress theme, make sure it is configured to handle the file type in the request. You may need to check the documentation for the web app, plug-in, or theme and see how to add new content type headers. If you need help figuring out how to do this, contact the developer.
  7. Make sure the client can receive the requested file. It's less common for there to be an issue on the client side, but it does happen. For example, if the server receives a JSON file, the client's "Accept" headers should read " Accept: application/json;". If the server is processing a text or HTML file, the client's header should read "Accept: text/html;". Likewise, if the server is processing an image file, it should read "Accept: image/*;" or something similar.
  8. After making changes to fix the error, test your application or website to make sure it can accept the requested file format. If the changes are successful, you should not receive an Error 415. If the problem persists, you may need to contact your server hosting provider or consult a professional programmer with experience in web applications. [3]
  9. Advertisement

Expert Q&A

Ask a Question
      Advertisement

      Tips

      Submit a Tip
      All tip submissions are carefully reviewed before being published
      Name
      Please provide your name and last initial
      Thanks for submitting a tip for review!

      About This Article

      Thanks to all authors for creating a page that has been read 274 times.

      Is this article up to date?

      Advertisement