Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add warning header #8063

Merged
merged 15 commits into from
May 24, 2024
8 changes: 8 additions & 0 deletions app/controllers/general.php
Original file line number Diff line number Diff line change
Expand Up @@ -543,8 +543,16 @@ function router(App $utopia, Database $dbForConsole, callable $getProjectDB, Swo
$response->addHeader('Strict-Transport-Security', 'max-age=' . (60 * 60 * 24 * 126)); // 126 days
}

$defaultResponseFormat = APP_VERSION_STABLE;
if ($defaultResponseFormat !== 'UNKNOWN') {
$defaultResponseFormat = \explode('.', $defaultResponseFormat);
$defaultResponseFormat[2] = '0';
loks0n marked this conversation as resolved.
Show resolved Hide resolved
$defaultResponseFormat = \implode('.', $defaultResponseFormat);
}

$response
->addHeader('Server', 'Appwrite')
->addHeader('X-Appwrite-Default-Response-Format', $defaultResponseFormat)
->addHeader('X-Content-Type-Options', 'nosniff')
->addHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, PATCH, DELETE')
->addHeader('Access-Control-Allow-Headers', 'Origin, Cookie, Set-Cookie, X-Requested-With, Content-Type, Access-Control-Allow-Origin, Access-Control-Request-Headers, Accept, X-Appwrite-Project, X-Appwrite-Key, X-Appwrite-Locale, X-Appwrite-Mode, X-Appwrite-JWT, X-Appwrite-Response-Format, X-Appwrite-Timeout, X-SDK-Version, X-SDK-Name, X-SDK-Language, X-SDK-Platform, X-SDK-GraphQL, X-Appwrite-ID, X-Appwrite-Timestamp, Content-Range, Range, Cache-Control, Expires, Pragma, X-Forwarded-For, X-Forwarded-User-Agent')
Expand Down