perf: 프로필 공용 정적 자산 경로를 제공한다
Caddy가 commit-digest 공용 asset과 sourcemap을 immutable URL로 제공하고, runtime에 공용 공개 경로를 명시한다.
This commit is contained in:
@@ -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/);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user