Skip to content

Commit

Permalink
Merge pull request #20955 from nextcloud/httpcache-18
Browse files Browse the repository at this point in the history
[stable18] Proxy server could cache http response when it is not private
  • Loading branch information
rullzer committed May 15, 2020
2 parents afce3d8 + 43351ec commit 62950e9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/public/AppFramework/Http/Response.php
Expand Up @@ -106,11 +106,11 @@ public function __construct() {
* @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();
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/AppFramework/Http/ResponseTest.php
Expand Up @@ -268,7 +268,7 @@ public function testChainability() {
$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']);

}
Expand Down

0 comments on commit 62950e9

Please sign in to comment.