修复维护页品牌图片加载
Nginx 精确放行维护页背景图与品牌图标 Pingora 同步维护资产白名单 补充维护模式网关回归测试 更新生产运维与共享决策文档
This commit is contained in:
@@ -148,6 +148,10 @@ function validateGatewayConfiguration() {
|
||||
'try_files /page.html @genarrative_default_maintenance;',
|
||||
'location @genarrative_default_maintenance',
|
||||
'root /srv/genarrative/web;',
|
||||
'location = /branding/taonier-maintenance-page.png',
|
||||
'try_files /branding/taonier-maintenance-page.png =404;',
|
||||
'location = /branding/taonier-product-ip.png',
|
||||
'try_files /branding/taonier-product-ip.png =404;',
|
||||
]) {
|
||||
if (!nginxSnippet.includes(expected)) {
|
||||
fail(`Nginx 维护页配置缺少运行态覆盖约束: ${expected}`);
|
||||
@@ -161,6 +165,7 @@ function validateGatewayConfiguration() {
|
||||
for (const expected of [
|
||||
'GENARRATIVE_PINGORA_GATEWAY_MAINTENANCE_PAGE_FILE',
|
||||
'maintenance_page_file',
|
||||
'is_maintenance_page_asset(path)',
|
||||
]) {
|
||||
if (!pingoraSource.includes(expected)) {
|
||||
fail(`Pingora 维护页配置缺少运行态覆盖约束: ${expected}`);
|
||||
|
||||
@@ -164,6 +164,10 @@ function validateMaintenanceInternalBypass() {
|
||||
fail(`${MAINTENANCE_SNIPPET_PATH} 不应保留仅后台使用的维护变量。`);
|
||||
}
|
||||
for (const fragment of [
|
||||
'location = /branding/taonier-maintenance-page.png {',
|
||||
'try_files /branding/taonier-maintenance-page.png =404;',
|
||||
'location = /branding/taonier-product-ip.png {',
|
||||
'try_files /branding/taonier-product-ip.png =404;',
|
||||
'location = /404.html {',
|
||||
'if ($http_accept !~* "text/html") {',
|
||||
'try_files /404.html =404;',
|
||||
|
||||
@@ -347,6 +347,19 @@ async function prepareStaticRoots(webRoot, acmeRoot) {
|
||||
path.join(webRoot, 'maintenance.html'),
|
||||
'<main>default-maintenance</main>',
|
||||
);
|
||||
await mkdir(path.join(webRoot, 'branding'), { recursive: true });
|
||||
for (const fileName of [
|
||||
'taonier-maintenance-page.png',
|
||||
'taonier-product-ip.png',
|
||||
]) {
|
||||
await writeFile(
|
||||
path.join(webRoot, 'branding', fileName),
|
||||
Buffer.concat([
|
||||
PNG_MAGIC_BYTES,
|
||||
Buffer.from([0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52]),
|
||||
]),
|
||||
);
|
||||
}
|
||||
await writeFile(path.join(webRoot, '404.html'), '<main>not-found-page</main>');
|
||||
await writeFile(
|
||||
path.join(acmeRoot, '.well-known', 'acme-challenge', 'token'),
|
||||
@@ -1204,6 +1217,14 @@ async function runSmokeCases(
|
||||
},
|
||||
);
|
||||
}
|
||||
for (const path of [
|
||||
'/branding/taonier-maintenance-page.png',
|
||||
'/branding/taonier-product-ip.png',
|
||||
]) {
|
||||
await expectStaticPng(baseUrl, path, `维护模式放行品牌图片 ${path}`, {
|
||||
headers: publicClientHeaders,
|
||||
});
|
||||
}
|
||||
await rm(maintenancePageFile, { force: true });
|
||||
await expectHttp(
|
||||
baseUrl,
|
||||
@@ -1433,9 +1454,10 @@ async function expectNotCompressedResponse(baseUrl, route, bodyNeedle, label) {
|
||||
}
|
||||
}
|
||||
|
||||
async function expectStaticPng(baseUrl, route, label) {
|
||||
async function expectStaticPng(baseUrl, route, label, options = {}) {
|
||||
console.log(`[pingora-gateway-smoke] ${label}`);
|
||||
const response = await requestHttp(`${baseUrl}${route}`, {
|
||||
headers: options.headers,
|
||||
rawBody: true,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user