diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2022-09-21 14:58:14 +0300 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2022-09-27 20:51:11 +0300 |
commit | 485b916cdf140289510571ec8573f92435057af9 (patch) | |
tree | 25089bf95dc4d4d5cb5106644259a664ca25a9e6 /lib/Controller/AutoConfigController.php | |
parent | a4edc5150863563ad36425e3857cfca51393e979 (diff) |
Improve HTTP caching
* More immutable cache headers
* Cache itinerary responses
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib/Controller/AutoConfigController.php')
-rw-r--r-- | lib/Controller/AutoConfigController.php | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/Controller/AutoConfigController.php b/lib/Controller/AutoConfigController.php index 796f7a42a..1c2517753 100644 --- a/lib/Controller/AutoConfigController.php +++ b/lib/Controller/AutoConfigController.php @@ -62,20 +62,22 @@ class AutoConfigController extends Controller { public function queryIspdb(string $email): JsonResponse { $rfc822Address = new Horde_Mail_Rfc822_Address($email); if (!$rfc822Address->valid) { - return JsonResponse::fail('Invalid email address', Http::STATUS_UNPROCESSABLE_ENTITY); + return JsonResponse::fail('Invalid email address', Http::STATUS_UNPROCESSABLE_ENTITY) + ->cacheFor(60 * 60, false, true); } $config = $this->ispDb->query($rfc822Address->host, $rfc822Address); - return JsonResponse::success($config); + return JsonResponse::success($config)->cacheFor(5 * 60, false, true); } public function queryMx(string $email): JsonResponse { $rfc822Address = new Horde_Mail_Rfc822_Address($email); if (!$rfc822Address->valid) { - return JsonResponse::fail('Invalid email address', Http::STATUS_UNPROCESSABLE_ENTITY); + return JsonResponse::fail('Invalid email address', Http::STATUS_UNPROCESSABLE_ENTITY) + ->cacheFor(60 * 60, false, true); } return JsonResponse::success( $this->mxRecord->query($rfc822Address->host), - ); + )->cacheFor(5 * 60, false, true); } public function testConnectivity(string $host, int $port): JsonResponse { |