perf: 프로필 공용 정적 자산 경로를 제공한다

Caddy가 commit-digest 공용 asset과 sourcemap을 immutable URL로 제공하고, runtime에 공용 공개 경로를 명시한다.
This commit is contained in:
2026-08-22 17:54:50 +00:00
parent dcff9eb094
commit 0c2b9632eb
5 changed files with 50 additions and 6 deletions
+26
View File
@@ -24,6 +24,26 @@ test('Caddy caches only content-hashed Vite frontend assets as immutable', async
caddyfile,
/header @immutableFrontendAssets >Cache-Control "public, max-age=31536000, immutable"/,
);
const sharedMatcher = caddyfile.match(
/@immutableSharedProfileAssets path_regexp immutableSharedProfileAssets (\S+)/,
);
assert.ok(sharedMatcher, 'immutable shared profile asset matcher must exist');
const sharedAssetPath = new RegExp(sharedMatcher[1]);
const releaseId = `${'a'.repeat(40)}-${'b'.repeat(16)}`;
assert.equal(
sharedAssetPath.test(`/gateway/profile-assets/${releaseId}/assets/index-CcXtLSVk.js`),
true,
);
assert.equal(
sharedAssetPath.test(`/gateway/profile-assets/${releaseId}/assets/index-CcXtLSVk.js.map`),
true,
);
assert.equal(sharedAssetPath.test(`/gateway/profile-assets/${releaseId}/index.html`), false);
assert.match(
caddyfile,
/header @immutableSharedProfileAssets >Cache-Control "public, max-age=31536000, immutable"/,
);
});
test('Caddy serves published frontend artifacts directly and keeps a transition fallback', async () => {
@@ -47,4 +67,10 @@ test('Caddy serves published frontend artifacts directly and keeps a transition
}
assert.match(caddyfile, /try_files \{path\} \/index\.html/);
assert.match(caddyfile, /header @frontendRequests Cache-Control "no-cache"/);
assert.match(
caddyfile,
/@sharedProfileAsset path_regexp sharedProfileAsset \^\/gateway\/profile-assets\//,
);
assert.match(caddyfile, /root \* \/srv\/frontend-artifacts\/game-assets\/releases/);
assert.match(caddyfile, /uri strip_prefix \/gateway\/profile-assets/);
});
+1
View File
@@ -21,6 +21,7 @@ const safeRuntime = {
VITE_IMAGE_PUBLIC_URL: 'https://sam-image.hided.net',
VITE_GATEWAY_USER_ICON_BASE_URL: 'https://sam-image.hided.net/icons',
FRONTEND_SERVE_MODE: 'static',
FRONTEND_SHARED_ASSET_PUBLIC_PATH: '/gateway/profile-assets',
RELEASE_BUILDER_URL: 'http://builder:15100',
GATEWAY_ACTIVE_RELEASE_GIT_REF: 'refs/sammo/active-gateway',
},