From 6c5f0d3aebbd9debcd33a9aab306b130547852a5 Mon Sep 17 00:00:00 2001 From: kontrollanten <6680299+kontrollanten@users.noreply.github.com> Date: Tue, 4 Oct 2022 10:53:00 +0200 Subject: server: serve files from storage/well-known (#5214) * server: serve files from storage/well-known closes #5206 * well-known: add tests * test: try to skip new tests * test: another try * fix(config/prod): well_known path * test: fix broken tests * Update misc-endpoints.ts * Use getDirectoryPath for tests * Fix tests Co-authored-by: Chocobozzz --- server/controllers/well-known.ts | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'server/controllers') diff --git a/server/controllers/well-known.ts b/server/controllers/well-known.ts index f467bd629..ce5883571 100644 --- a/server/controllers/well-known.ts +++ b/server/controllers/well-known.ts @@ -5,6 +5,7 @@ import { root } from '@shared/core-utils' import { CONFIG } from '../initializers/config' import { ROUTE_CACHE_LIFETIME, WEBSERVER } from '../initializers/constants' import { cacheRoute } from '../middlewares/cache/cache' +import { handleStaticError } from '@server/middlewares' const wellKnownRouter = express.Router() @@ -69,6 +70,12 @@ wellKnownRouter.use('/.well-known/host-meta', } ) +wellKnownRouter.use('/.well-known/', + cacheRoute(ROUTE_CACHE_LIFETIME.WELL_KNOWN), + express.static(CONFIG.STORAGE.WELL_KNOWN_DIR, { fallthrough: false }), + handleStaticError +) + // --------------------------------------------------------------------------- export { -- cgit v1.2.3