PR review changes
This commit is contained in:
parent
45e9040fa5
commit
4110709874
3 changed files with 5 additions and 5 deletions
|
@ -78,9 +78,9 @@ return [
|
||||||
'description' => 'An internal server error occurred.',
|
'description' => 'An internal server error occurred.',
|
||||||
'code' => 500,
|
'code' => 500,
|
||||||
],
|
],
|
||||||
Exception::GENERAL_FORCED_HTTPS_IGNORED => [
|
Exception::GENERAL_METHOD_UNSUPPORTED => [
|
||||||
'name' => Exception::GENERAL_FORCED_HTTPS_IGNORED,
|
'name' => Exception::GENERAL_METHOD_UNSUPPORTED,
|
||||||
'description' => 'Appwrite instance forces secure communication. Switch to HTTPS protocol in your endpoint.',
|
'description' => 'The HTTP method is unsupported by the current protocol or resource.',
|
||||||
'code' => 500,
|
'code' => 500,
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
|
@ -174,7 +174,7 @@ App::init(function ($utopia, $request, $response, $console, $project, $dbForCons
|
||||||
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') {
|
if ($request->getProtocol() !== 'https') {
|
||||||
if($request->getMethod() !== Request::METHOD_GET) {
|
if($request->getMethod() !== Request::METHOD_GET) {
|
||||||
throw new Exception('HTTPS communication required.', 500, Exception::GENERAL_FORCED_HTTPS_IGNORED);
|
throw new Exception('Method unsupported over HTTP.', 405, Exception::GENERAL_METHOD_UNSUPPORTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $response->redirect('https://'.$request->getHostname().$request->getURI());
|
return $response->redirect('https://'.$request->getHostname().$request->getURI());
|
||||||
|
|
|
@ -46,7 +46,7 @@ class Exception extends \Exception
|
||||||
const GENERAL_ROUTE_NOT_FOUND = 'general_route_not_found';
|
const GENERAL_ROUTE_NOT_FOUND = 'general_route_not_found';
|
||||||
const GENERAL_CURSOR_NOT_FOUND = 'general_cursor_not_found';
|
const GENERAL_CURSOR_NOT_FOUND = 'general_cursor_not_found';
|
||||||
const GENERAL_SERVER_ERROR = 'general_server_error';
|
const GENERAL_SERVER_ERROR = 'general_server_error';
|
||||||
const GENERAL_FORCED_HTTPS_IGNORED = 'general_forced_https_ignored';
|
const GENERAL_METHOD_UNSUPPORTED = 'general_method_unsupported';
|
||||||
|
|
||||||
/** Users */
|
/** Users */
|
||||||
const USER_COUNT_EXCEEDED = 'user_count_exceeded';
|
const USER_COUNT_EXCEEDED = 'user_count_exceeded';
|
||||||
|
|
Loading…
Reference in a new issue