While using images, video, and GIFs was not typical in the early days of the web, we now expect that a site offers appealing visuals as well as informative text. It’s also no surprise that when the communication between the browser and server goes awry due to a mismatch in media you’ll see an error. In this case, the “HTTP 415” error.

Because media is almost a prerequisite of the modern web, seeing an error relating to it means you’ll need a fix, fast. However, unlike other error fixes – especially for WordPress websites – this issue is one tough cookie. You may need some coding knowledge to solve this one, but this is something for later on.

Check Out Our Video Guide to Fixing the 415 Error

For this post, we’re going to look into the “HTTP 415” error, and talk about what causes it. From there, we’ll discuss how you’d fix it.


What the HTTP 415 Error Is

The “HTTP 415” error is one of many 4XX status codes. If you understand that it buddies up with errors such as a 404, you’ll begin to understand what’s happening.

In short, 4XX errors all deal with something missing that either the client or the server needs. The full name of the error – a “415 Unsupported Media Type” – gives the game away. The server is receiving a media file type that it doesn’t recognize or can’t accept.

Under most circumstances, you’ll see the “HTTP 415” error when you use an application programming interface (API). It’s a server-side issue, and next, we’ll discuss why this happens in the first place.

When the communication between the browser & server goes awry due to a mismatch in media, you’ll see an error. In this case, the “HTTP 415” error. 😅 Learn how to fix it here ✅Click to Tweet

Why the HTTP 415 Error Happens

Regardless of what you call it – the “HTTP 415” error, the “415 Unsupported Media Type” error – it means that the server refuses to accept a request from the browser. This will often be because whatever the browser sends (the payload) isn’t in the right format.

It’s a similar issue to the “422 Unprocessable Entity” error, as they both deal with the wrong data hitting the server, and the latter freaking out. It’s also worth pointing out that there is a distinction between the data the browser sends, and what the server receives. They may appear to be the same, but there’s a difference.

For example, a general error-catching strategy will stop a user from taking an unrecognized file type and uploading it through an interface that only accepts PNGs. However, if you don’t specify the exact types of media a server can process, it would trigger an error on the back end. On the front end, a user might not see anything at all. WordPress users get an admin screen notification:

The WordPress Upload New Media screen, showing the uploader dialog with a Select Files button, information on the maximum file size, and an admin error that shows a ‘file type not permitted’ error, and details of the file.
The File Type Not Permitted error within WordPress.

The good news is that WordPress has a permissive infrastructure – think of the different file types you can upload to the Media Library, for example.

Even so, this is a developer-level issue rather than user error. As such, we’ll dive into what the fixes might be next.

How To Fix the HTTP 415 Error

To recap, the “HTTP 415” error tells you that the server won’t accept a file type because it doesn’t support that payload. This means there’s an issue within the underlying PHP code that needs a fix.

At this point, if you aren’t the developer of the site or theme, and you don’t have any coding skills, you’ll likely want to contact someone with expertise. Poking around in your theme’s files could cause an issue.

However, the Mozilla documentation on the error gives you two clues to begin your search – two ‘representation headers’: Content-Type, and Content-Encoding.

How the Content-Type and Content-Encoding Headers Work

The Content-Type header provides the client request with the resource before any encoding happens. It indicates the original media type of the resource. For example:


Content-Type: text/html; charset=UTF-8

Content-Type: image/jpeg;

In contrast, Content-Encoding is a list of all of the encodings the payload (i.e. your media) has, which is an indicator of how the file should be decoded in order to get the original payload.


Content-Encoding: gzip

Content-Encoding: br

As you can tell, file compression is a common way to encode data. This isn’t a problem in theory but will be if you don’t code this into the relevant files for your theme or plugin.

Struggling with downtime and WordPress problems? Kinsta is the hosting solution designed to save you time! Check out our features

Finding a Fix For the HTTP 415 Error Code

Given the above, you’ll have three avenues to explore if you uncover an HTTP 415 error – all of them relating to your PHP code:

  • You’ll want to ensure you send the right Content-Type header value.
  • You will also want to make sure that the server can process whatever you specify for the Content-Type header.
  • Check over what the server can process through the Accept header.

You won’t necessarily do this within core files, although you may do so as part of a REST API request. For example, a user from Stack Overflow had this exact issue when using pure PHP over cURL to make an API request.

There are two places to look. First, specify the correct file types within the Content-Type header:


$headers = array (

    ‘Content-Type’ => ‘application/json’,

   …

Second, this user had a typo while declaring an invalid header key using the wp_remote_post() function:


$arg = array (

    'header' => $headers,

    …

Because “header” misses an “s”, it would throw the “HTTP 415” error. However, you’ll also want to make sure that the client can accept the right file types too. You’ll do this through another header: Accept. For example:


Accept: text/html

Accept: image/*

This makes sure both ends of the chain – the client and server side – can accept and send the right file types, and put a halt to the “HTTP 415” error for good.

Let's look into the “HTTP 415” error- and talk about what causes it- in this guide 🚀Click to Tweet

Summary

Website errors are often straightforward to fix. We’ve done so a number of times on the Kinsta blog, and the nature of the platform means you can be ready to rock and roll in a short while. However, the “HTTP 415” is different, in that a fix is hard to come by if you’re not a developer.

The solution is to work with the Content-Type header values to make sure you send the right one to the server. You may also have a simple typo. This seems like a “doh” moment, but in this case, they can be tricky to spot, especially if your concern is with the content types you send to the server.

While the “HTTP 415” error is yours to fix, for other issues with your website, Kinsta is on call. We have our support team standing by to help you understand your site on the rare occasions it fails to load.


Save time, costs and maximize site performance with:

  • Instant help from WordPress hosting experts, 24/7.
  • Cloudflare Enterprise integration.
  • Global audience reach with 35 data centers worldwide.
  • Optimization with our built-in Application Performance Monitoring.

All of that and much more, in one plan with no long-term contracts, assisted migrations, and a 30-day-money-back-guarantee. Check out our plans or talk to sales to find the plan that’s right for you.