Apache ignoring PHP headers when sending a 304

前端 未结 4 2046
既然无缘
既然无缘 2021-01-18 08:25

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

header(\'Foo: Bar\');

But when I try this while also sending a 3

4条回答
  •  我在风中等你
    2021-01-18 09:08

    I do a trick to solve this issue by : 1. put all header before 304 header 2. flush these header before send 304

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

    Apache will not remove any header until it found 304. We force other header send out by flush() before send 304. That apache can not hurt me.

提交回复
热议问题