mirror of
https://github.com/nextcloud/server.git
synced 2026-06-12 18:21:40 -04:00
Merge pull request #20955 from nextcloud/httpcache-18
[stable18] Proxy server could cache http response when it is not private
This commit is contained in:
commit
62950e9f9b
2 changed files with 4 additions and 4 deletions
|
|
@ -106,11 +106,11 @@ class Response {
|
|||
* @since 6.0.0 - return value was added in 7.0.0
|
||||
*/
|
||||
public function cacheFor(int $cacheSeconds) {
|
||||
if($cacheSeconds > 0) {
|
||||
$this->addHeader('Cache-Control', 'max-age=' . $cacheSeconds . ', must-revalidate');
|
||||
if ($cacheSeconds > 0) {
|
||||
$this->addHeader('Cache-Control', 'private, max-age=' . $cacheSeconds . ', must-revalidate');
|
||||
|
||||
// Old scool prama caching
|
||||
$this->addHeader('Pragma', 'public');
|
||||
$this->addHeader('Pragma', 'private');
|
||||
|
||||
// Set expires header
|
||||
$expires = new \DateTime();
|
||||
|
|
|
|||
|
|
@ -268,7 +268,7 @@ class ResponseTest extends \Test\TestCase {
|
|||
$this->assertEquals(Http::STATUS_NOT_FOUND, $this->childResponse->getStatus());
|
||||
$this->assertEquals('hi', $this->childResponse->getEtag());
|
||||
$this->assertEquals('Thu, 01 Jan 1970 00:00:01 +0000', $headers['Last-Modified']);
|
||||
$this->assertEquals('max-age=33, must-revalidate',
|
||||
$this->assertEquals('private, max-age=33, must-revalidate',
|
||||
$headers['Cache-Control']);
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue