1
0
Fork 0
mirror of synced 2024-07-05 22:51:24 +12:00

Merge pull request #7059 from appwrite/fix/function-domains-execution

Fix 400 error on function domain execution
This commit is contained in:
Christy Jacob 2023-10-31 23:17:16 +04:00 committed by GitHub
commit 311fc0f0c4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View file

@ -408,7 +408,7 @@ App::init()
* @see https://www.owasp.org/index.php/List_of_useful_HTTP_headers * @see https://www.owasp.org/index.php/List_of_useful_HTTP_headers
*/ */
if (App::getEnv('_APP_OPTIONS_FORCE_HTTPS', 'disabled') === 'enabled') { // Force HTTPS if (App::getEnv('_APP_OPTIONS_FORCE_HTTPS', 'disabled') === 'enabled') { // Force HTTPS
if ($request->getProtocol() !== 'https' && ($requestHeaders['host'] ?? '') !== 'localhost' && ($requestHeaders['host'] ?? '') !== APP_HOSTNAME_INTERNAL) { // localhost allowed for proxy, APP_HOSTNAME_INTERNAL allowed for migrations if ($request->getProtocol() !== 'https' && ($swooleRequest->header['host'] ?? '') !== 'localhost' && ($swooleRequest->header['host'] ?? '') !== APP_HOSTNAME_INTERNAL) { // localhost allowed for proxy, APP_HOSTNAME_INTERNAL allowed for migrations
if ($request->getMethod() !== Request::METHOD_GET) { if ($request->getMethod() !== Request::METHOD_GET) {
throw new AppwriteException(AppwriteException::GENERAL_PROTOCOL_UNSUPPORTED, 'Method unsupported over HTTP. Please use HTTPS instead.'); throw new AppwriteException(AppwriteException::GENERAL_PROTOCOL_UNSUPPORTED, 'Method unsupported over HTTP. Please use HTTPS instead.');
} }

View file

@ -107,6 +107,10 @@ class Request extends UtopiaRequest
{ {
$headers = $this->generateHeaders(); $headers = $this->generateHeaders();
if (empty($this->swoole->cookie)) {
return $headers;
}
$cookieHeaders = []; $cookieHeaders = [];
foreach ($this->swoole->cookie as $key => $value) { foreach ($this->swoole->cookie as $key => $value) {
$cookieHeaders[] = "{$key}={$value}"; $cookieHeaders[] = "{$key}={$value}";