415
Unsupported Media Type
Specification of the HTTP status code 415
The 415 Unsupported Media Type status code indicates that 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.
Source / Quote by: The 415 Unsupported Media Type HTTP Status Code is specified by section 6.5.13 of RFC7231.
HTTP-Protocol
How to throw a 415 statuscode with PHP?
To throw the HTTP status code 415 on a web page, the PHP function http_response_code can be used. The syntax is as follows: http_response_code(415) (PHP 5 >= 5.4.0, PHP 7, PHP 8)
Test the 415 HTTP status code
In order to be able to display the HTTP status code (in this case 415 Unsupported Media Type) and other information on the client side, the development console must be opened with F12. Afterwards you have to navigate to the tab "Network". Now you can open the page, in the network tab you should see the web page (example index.php). This must be selected and then the Herder section must be selected. Here the user will see the following result:
URL: https://http-statuscode.com/errorCodeExample.php?code=415
Status: 415 Unsupported Media Type
Those: Network
IP address: XX.XX.XX.XX
How to create a custom error page for the 415 status code
Apache Webserver
The web server "Apache" is one of the most popular web servers on the Internet. To create an own 415 Unsupported Media Type error page in "Apache", the following change must be made in the following file.
NGINX Webserver
Similar to the web server "Apache", "NGINX" is also widely used on the Internet. To create your own 415 Unsupported Media Type error page in "NGINX", the following change must be made in the following file.
location = /415.html {
root /usr/share/nginx/html;
internal;
}
Browser compatibility of the 415 status code
Chrome | no data |
Edge | no data |
Firefox | no data |
Opera | no data |
Safari | no data |
Chrome Android | no data |
Firefox for Android | no data |
Opera Android | no data |
Safari on iOS | no data |
Internet | no data |
WebView Android | no data |
Constants in programming languages
HttpStatusCode.UnsupportedMediaType
http.StatusUnsupportedMediaType
Response::HTTP_UNSUPPORTED_MEDIA_TYPE
httplib.UNSUPPORTED_MEDIA_TYPE
http.client.UNSUPPORTED_MEDIA_TYPE
http.HTTPStatus.UNSUPPORTED_MEDIA_TYPE
:unsupported_media_type