Bug 58990 - Option to send "406 Not Acceptable" when mime type in "Accept" header cannot be fulfilled
Summary: Option to send "406 Not Acceptable" when mime type in "Accept" header cannot ...
Status: NEW
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: All (show other bugs)
Version: 2.5-HEAD
Hardware: PC Linux
: P2 enhancement with 3 votes (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-02-10 19:41 UTC by cweiske+bz.apache.org
Modified: 2016-02-10 19:41 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description cweiske+bz.apache.org 2016-02-10 19:41:47 UTC
Apache 2 returns as "200 OK" status code with the full contents when requesting a URL with an "Accept" header that does not match the content type:

> $ curl -I -H 'Accept: image/png' httpd.apache.org/
> HTTP/1.1 200 OK
> ...
> Content-Type: text/html

This is allowed by RFC 2616[1]:

> Note: HTTP/1.1 servers are allowed to return responses which are
> not acceptable according to the accept headers sent in the
> request.

I would still like to be able to force (configure) Apache to return a "406 Not Acceptable" when it cannot deliver the content type the client requests.

This would save bandwidth when e.g. crawlers fetch all links on a web site and express that they only understand HTML in their Accept header. Images and file downloads wouldn't be delivered to them then, saving bandwidth.


This issue is similare to bug #17936, but this here is a feature request.

[1] https://tools.ietf.org/html/rfc2616#section-10.4.7