Re: Sending 304 - Headers are altered by apache?
| From: | jtaal at eljakim dot nl | Date: | Mon, 03 Nov 2008 10:17:07 +0000 |
| Subject: | Re: Sending 304 - Headers are altered by apache? | ||
| References: | 1 2 3 4 5 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-51001@lists.php.net to get a copy of this message | ||
I've printed the contents of headers_list() to a file before my exit statement:
Array
(
[0] => X-Powered-By: PHP/5.2.6-5
[1] => Content-Type: text/javascript
[2] => Last-Modified: Mon, 29 Sep 2008 01:30:17 GMT
[3] => ETag: "0913b54314a70fd5d9a96a067d8960c7"
[4] => Status: 304 Not Modified
)
The Content-Type, Last-Modified and X-Powered-By headers are lost. Only the ETag header remains in the response...
jtaal@eljakim.nl wrote:
I've run wireshark to analyse the traffic. I see that the server is sending out the limited headers and I know the PHP process tried to send a 304. So why is the X-Powered-By header not coming through? I don't think this is entirely browser related. The requests headers are alike: Request headers: * When I request the resource in the browser explicitly:Host phpdev User-Agent Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3 FirePHP/0.2.1 Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language en-us,en;q=0.5 Accept-Encoding gzip,deflate Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive 300 Connection keep-alive Cookie test_application=f8c359a512a9db91da049fadeb2f16c0 If-Modified-Since Mon, 29 Sep 2008 01:30:17 GMT If-None-Match "0913b54314a70fd5d9a96a067d8960c7" Cache-Control max-age=0* When I have the resource in the HTML page:Host phpdev User-Agent Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3 FirePHP/0.2.1 Accept */* Accept-Language en-us,en;q=0.5 Accept-Encoding gzip,deflate Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive 300 Connection keep-alive Referer http://phpdev/~jtaal/widget/test_index.php Cookie test_application=f8c359a512a9db91da049fadeb2f16c0 If-Modified-Since Mon, 29 Sep 2008 01:30:17 GMT If-None-Match "0913b54314a70fd5d9a96a067d8960c7" Cache-Control max-age=0So what is causing Apache/PHP to leave out lots of the response headers?? Response headers: * When I request the resource in the browser explicitly (304):Date Mon, 03 Nov 2008 09:53:24 GMT Server Apache/2.2.9 (Debian) PHP/5.2.6-5 with Suhosin-Patch X-Powered-By PHP/5.2.6-5 Last-Modified Mon, 29 Sep 2008 01:30:17 GMT Etag "0913b54314a70fd5d9a96a067d8960c7" Content-Length 129738 Content-Type text/javascript* When I have the resource in the HTML page:Date Mon, 03 Nov 2008 09:36:22 GMT Server Apache/2.2.9 (Debian) PHP/5.2.6-5 with Suhosin-Patch Connection Keep-Alive Keep-Alive timeout=15, max=10000 Etag "0913b54314a70fd5d9a96a067d8960c7"I cannot stress enough that I believe the problem exists on the server, somehow triggered by the headers of the browser... Thanks for the help Jaap till wrote:On Tue, Oct 28, 2008 at 10:34 AM, <jtaal@eljakim.nl> wrote:Thanks for the tip. However, this doesn't work when my pear package processes a template file or get's an image from a database etc. Or maybe the script I'm creating won't be used by a pear package at all... So I'm still wondering why the response headers are disappearing?!I just thought about that and as far as I remember (and please correct me if I'm wrong), certain browsers have issues and may even disregard the E-TAG, cache headers etc. when a '?' is present in the URL. So for example, internally a CSS file may be generated using a call like: css.php?ver=1 ... but on the outside, you should employ a rewrite rule to make it look like that: css.1.php ... otherwise, it would never be cached. Till