Forgot about blueprints

This commit is contained in:
Julian van der Horst
2026-05-27 18:21:52 +02:00
parent 6c7d345f03
commit 9d6062619c
3 changed files with 20 additions and 7 deletions
+14 -4
View File
@@ -210,8 +210,16 @@ export async function updateProxyResources(
? true ? true
: resourceData.ssl; : resourceData.ssl;
let headers = ""; let headers = "";
if (resourceData.headers) { const requestHeadersData = [
headers = JSON.stringify(resourceData.headers); ...(resourceData.headers ?? []),
...(resourceData.requestHeaders ?? [])
];
if (requestHeadersData.length > 0) {
headers = JSON.stringify(requestHeadersData);
}
let responseHeaders = "";
if (resourceData.responseHeaders) {
responseHeaders = JSON.stringify(resourceData.responseHeaders);
} }
if (existingResource) { if (existingResource) {
@@ -265,7 +273,8 @@ export async function updateProxyResources(
] ]
? resourceData.auth["whitelist-users"].length > 0 ? resourceData.auth["whitelist-users"].length > 0
: false, : false,
headers: headers || null, requestHeaders: headers || null,
responseHeaders: responseHeaders || null,
applyRules: applyRules:
resourceData.rules && resourceData.rules.length > 0, resourceData.rules && resourceData.rules.length > 0,
maintenanceModeEnabled: maintenanceModeEnabled:
@@ -724,7 +733,8 @@ export async function updateProxyResources(
setHostHeader: resourceData["host-header"] || null, setHostHeader: resourceData["host-header"] || null,
tlsServerName: resourceData["tls-server-name"] || null, tlsServerName: resourceData["tls-server-name"] || null,
ssl: resourceSsl, ssl: resourceSsl,
headers: headers || null, requestHeaders: headers || null,
responseHeaders: responseHeaders || null,
applyRules: applyRules:
resourceData.rules && resourceData.rules.length > 0, resourceData.rules && resourceData.rules.length > 0,
maintenanceModeEnabled: resourceData.maintenance?.enabled, maintenanceModeEnabled: resourceData.maintenance?.enabled,
+3 -1
View File
@@ -175,7 +175,9 @@ export const ResourceSchema = z
auth: AuthSchema.optional(), auth: AuthSchema.optional(),
"host-header": z.string().optional(), "host-header": z.string().optional(),
"tls-server-name": z.string().optional(), "tls-server-name": z.string().optional(),
headers: z.array(HeaderSchema).optional(), headers: z.array(HeaderSchema).optional(), // deprecated alias for requestHeaders
requestHeaders: z.array(HeaderSchema).optional(),
responseHeaders: z.array(HeaderSchema).optional(),
rules: z.array(RuleSchema).optional(), rules: z.array(RuleSchema).optional(),
maintenance: MaintenanceSchema.optional() maintenance: MaintenanceSchema.optional()
}) })
+3 -2
View File
@@ -43,9 +43,10 @@ async function query(resourceId?: number, niceId?: string, orgId?: string) {
export type GetResourceResponse = Omit< export type GetResourceResponse = Omit<
NonNullable<Awaited<ReturnType<typeof query>>>, NonNullable<Awaited<ReturnType<typeof query>>>,
"headers" "requestHeaders" | "responseHeaders"
> & { > & {
headers: { name: string; value: string }[] | null; requestHeaders: { name: string; value: string }[] | null;
responseHeaders: { name: string; value: string }[] | null;
}; };
registry.registerPath({ registry.registerPath({