Add Vary header in case of content negotiation
Sometimes we return different content depending on whether JSON, XML or HTML was requested in the Accept request header. The Vary response header should list that header in these cases, to allow caching frameworks to determine what to cache.
This commit is contained in:
@@ -90,6 +90,8 @@ class Friendica extends BaseModule
|
||||
$blocked = null;
|
||||
}
|
||||
|
||||
header('Vary: Accept', false);
|
||||
|
||||
$hooked = '';
|
||||
|
||||
Hook::callAll('about_hook', $hooked);
|
||||
@@ -125,6 +127,7 @@ class Friendica extends BaseModule
|
||||
$data = ActivityPub\Transmitter::getProfile(0);
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
header('Cache-Control: max-age=23200, stale-while-revalidate=23200');
|
||||
header('Vary: Accept', false);
|
||||
System::jsonExit($data, 'application/activity+json');
|
||||
} catch (HTTPException\NotFoundException $e) {
|
||||
System::jsonError(404, ['error' => 'Record not found']);
|
||||
|
||||
Reference in New Issue
Block a user