Merge pull request #13233 from GidiKroon/feature/add-vary-header
Add Vary header in case of content negotiation
This commit is contained in:
commit
7edaeb215d
5 changed files with 10 additions and 1 deletions
|
@ -46,6 +46,8 @@ class Objects extends BaseModule
|
|||
throw new HTTPException\BadRequestException();
|
||||
}
|
||||
|
||||
header('Vary: Accept', false);
|
||||
|
||||
if (!ActivityPub::isRequest()) {
|
||||
DI::baseUrl()->redirect(str_replace('objects/', 'display/', DI::args()->getQueryString()));
|
||||
}
|
||||
|
|
|
@ -115,6 +115,8 @@ class Friendica extends BaseModule
|
|||
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
header('Vary: Accept', false);
|
||||
|
||||
// @TODO: Replace with parameter from router
|
||||
if (DI::args()->getArgc() <= 1 || (DI::args()->getArgv()[1] !== 'json')) {
|
||||
if (!ActivityPub::isRequest()) {
|
||||
|
|
|
@ -88,6 +88,8 @@ class Display extends BaseModule
|
|||
|
||||
protected function content(array $request = []): string
|
||||
{
|
||||
header('Vary: Accept', false);
|
||||
|
||||
if (ActivityPub::isRequest()) {
|
||||
$this->baseUrl->redirect(str_replace('display/', 'objects/', $this->args->getQueryString()));
|
||||
}
|
||||
|
|
|
@ -80,6 +80,8 @@ class Profile extends BaseProfile
|
|||
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
header('Vary: Accept', false);
|
||||
|
||||
if (ActivityPub::isRequest()) {
|
||||
$user = $this->database->selectFirst('user', ['uid'], ['nickname' => $this->parameters['nickname'] ?? '', 'account_removed' => false]);
|
||||
if ($user) {
|
||||
|
|
|
@ -80,6 +80,8 @@ class Xrd extends BaseModule
|
|||
throw new NotFoundException('Invalid host name for xrd query: ' . $host);
|
||||
}
|
||||
|
||||
header('Vary: Accept', false);
|
||||
|
||||
if ($name == User::getActorName()) {
|
||||
$owner = User::getSystemAccount();
|
||||
if (empty($owner)) {
|
||||
|
@ -326,7 +328,6 @@ class Xrd extends BaseModule
|
|||
]);
|
||||
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
|
||||
System::httpExit($xmlString, Response::TYPE_XML, 'application/xrd+xml');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue