skyler
skyler

Reputation: 8348

ETag header not being sent from PHP

I'm running PHP 5.3.2 and Apache 2.2.14. Using header(), If I send "ETagx" I get the header in the response, but if I send "ETag", the correct header name, I get nothing.

header('ETagx: "33653a-4831d8249af80"')

works, while

header('ETag: "33653a-4831d8249af80"')

does not. Is there a configuration option in php.ini, or in any of the Apache configuration files that might affect this?

Upvotes: 1

Views: 2777

Answers (2)

user3417917
user3417917

Reputation: 196

I replicated this situation when I had Charles HTTP Proxy active with the 'No Caching' option enabled - the HTTP proxy was removing the ETag and other cache-related headers. If using a proxy to view the headers, ensure that caching is enabled for the specific request.

Upvotes: 1

Cleric
Cleric

Reputation: 3203

Just tested on PHP 5.3 and Apache 2.4 and it worked for me.

Make sure that Apache don't unset your Etag like this:

<IfModule mod_headers.c>
  Header unset ETag
</IfModule>

FileETag None

Upvotes: 2

Related Questions