diff --git a/server/.github/test.conf.json5 b/server/.github/test.conf.json5 index 81606dc3d..8bed06276 100644 --- a/server/.github/test.conf.json5 +++ b/server/.github/test.conf.json5 @@ -23,6 +23,7 @@ TYPE: "omni", ENABLE_SERVER_HTTPS: false, RUN_OWN_CDN: true, + CDN_WEB_LOCATION: "/cdn", OUR_URL: "https://example.com", EMAIL_CONFIG: { FROM: "test ", diff --git a/server/src/lib/cdn/cdn.ts b/server/src/lib/cdn/cdn.ts index 68dadfcf0..5e1c7d7bc 100644 --- a/server/src/lib/cdn/cdn.ts +++ b/server/src/lib/cdn/cdn.ts @@ -42,7 +42,7 @@ export function CDNRedirect(res: Response, fileLoc: string) { throw new Error(`Invalid fileLoc - did not start with /.`); } - return res.redirect(`/cdn${fileLoc}`); + return res.redirect(`${ServerConfig.CDN_WEB_LOCATION}${fileLoc}`); } /** diff --git a/server/src/lib/setup/config.ts b/server/src/lib/setup/config.ts index 52f70d018..b291a78c6 100644 --- a/server/src/lib/setup/config.ts +++ b/server/src/lib/setup/config.ts @@ -78,6 +78,7 @@ export interface TachiConfig { LOGGER_DISCORD_WEBHOOK?: string; DISCORD_WHO_TO_TAG?: string[]; ENABLE_PUBLIC_SIGNUP?: boolean; + CDN_WEB_LOCATION: string; } const isValidOauth2 = p.optional({ @@ -118,6 +119,7 @@ const err = p(config, { LOGGER_DISCORD_WEBHOOK: "*string", DISCORD_WHO_TO_TAG: p.optional(["string"]), ENABLE_PUBLIC_SIGNUP: "*boolean", + CDN_WEB_LOCATION: "string", }); if (err) {