Bug #55063 [Nab]: Additional headers are ignored when returning HTTP status 304
| From: | mike@php.net | Date: | Thu, 16 Jul 2015 11:18:54 +0000 |
| Subject: | Bug #55063 [Nab]: Additional headers are ignored when returning HTTP status 304 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-194488@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=55063&edit=1
ID: 55063
Updated by: mike@php.net
Reported by: evert at rooftopsolutions dot nl
Summary: Additional headers are ignored when returning HTTP
status 304
Status: Not a bug
Type: Bug
Package: Apache2 related
Operating System: Any
PHP Version: 5.3.6
Block user comment: N
Private report: N
New Comment:
Sorry for the blurb; note to self: avoid the quick-fix dropdown.
Previous Comments:
------------------------------------------------------------------------
[2015-07-16 08:09:27] mike@php.net
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions. Due to the volume
of reports we can not explain in detail here why your report is not
a bug. The support channels will be able to provide an explanation
for you.
Thank you for your interest in PHP.
Apache will only send the following header fields on 304:
"Connection",
"Keep-Alive",
"ETag",
"Content-Location",
"Expires",
"Cache-Control",
"Vary",
"Warning",
"WWW-Authenticate",
"Proxy-Authenticate",
"Set-Cookie",
"Set-Cookie2",
See https://github.com/apache/httpd/blob/2.4.x/modules/http/http_filters.c#L1332
------------------------------------------------------------------------
[2011-06-29 05:56:33] evert at rooftopsolutions dot nl
Description:
------------
When HTTP status 304 is set, Apache appears to ignore any other headers. X-
Powered-By is also missing, which was the first hint that something was up in
either the SAPI or Apache.
I'm not fully sure this is a PHP bug, or an Apache bug though, so feel free to
close it if I put it in the wrong space.
The practical use-case I have for this is the so-called CORS headers. When I do a
cross-domain request within firefox, and CORS headers have expired firefox
requires them to be set, even for the 304 response. Since they get stripped,
firefox just throws an error.
Test script:
---------------
header('HTTP/1.1 304 Not Modified')
header('X-Foo: Bar');
Expected result:
----------------
The X-Foo header returned
Actual result:
--------------
All custom headers are ignored
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=55063&edit=1