After I set a custom header in Apache + mod_php5, this works fine:

header('Foo: Bar');

However when I attempt this while also delivering a 304 Not Modified response, the header seems to become removed by apache (together with X-Powered-By along with other standard headers).

header('HTTP/1.1 304 No Content');
header('Foo: Bar');

Does anybody understand how to solve this problem?

Performs this not answer the question?

When the conditional GET used a powerful cache validator (see section 13.3.3), the response Shouldn't include other entity-headers. Otherwise (i.e., the conditional GET used an inadequate validator), the response Mustn't include other entity-headers jetski from incongruencies between cached entity-physiques and up-to-date headers.

from http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.5

Try:

header('Foo: bar', true, 304);