Description
Q | A |
---|---|
Bug report? | yes |
Feature request? | no |
BC Break report? | yes/no |
RFC? | no |
Symfony version | 3.4.0-BETA3 |
I have Apache2 + PHP-FPM setup and after update to 3.4.0-BETA3 (from BETA1) I encountered a problem with Apache returning 304 for all consequent requests on a single URL. Even if response body sent from PHP changed.
This is expected behaviour in case when client sends If-Modified-Since
and PHP response with Last-Modified
header. The problem is that the Last-Modified
header is sent even if I don't set the header by myself.
I was able to trace down the problem to the commit 95d0b72. It removes explicit check for a started session in RequestDataCollector::onKernelResponse
and then by calling $event->getRequest()->getSession()->has('sf_redirect')
it triggers session_start()
which directly sends Last-Modified
header.
Here is dump of headers_sent()
at end of request for BETA2 and BETA3:
# BETA2
array(4) {
[0]=>
string(32) "Cache-Control: no-cache, private"
[1]=>
string(35) "Date: Tue, 07 Nov 2017 07:23:35 GMT"
[2]=>
string(30) "Content-Type: application/json"
[3]=>
string(21) "X-Debug-Token: 1366e0"
}
# BETA3
array(6) {
[0]=>
string(33) "Cache-Control: private, max-age=0"
[1]=>
string(44) "Last-Modified: Tue, 07 Nov 2017 07:25:09 GMT"
[2]=>
string(32) "Cache-Control: no-cache, private"
[3]=>
string(35) "Date: Tue, 07 Nov 2017 07:28:31 GMT"
[4]=>
string(30) "Content-Type: application/json"
[5]=>
string(21) "X-Debug-Token: ad9ad3"
}