added advanced section to general page & custom host header field

This commit is contained in:
Matthias Palmetshofer 2025-04-15 13:17:46 +02:00
parent 64a2cc23c6
commit 25c125b96d
No known key found for this signature in database
6 changed files with 199 additions and 38 deletions

View file

@ -42,7 +42,8 @@ const updateHttpResourceBodySchema = z
applyRules: z.boolean().optional(),
domainId: z.string().optional(),
enabled: z.boolean().optional(),
tlsServerName: z.string().optional()
tlsServerName: z.string().optional(),
setHostHeader: z.string().optional()
})
.strict()
.refine((data) => Object.keys(data).length > 0, {
@ -78,6 +79,15 @@ const updateHttpResourceBodySchema = z
return true;
},
{ message: "Invalid TLS Server Name. Use domain name format, or save empty to remove the TLS Server Name." }
)
.refine(
(data) => {
if (data.setHostHeader) {
return tlsNameSchema.safeParse(data.setHostHeader).success;
}
return true;
},
{ message: "Invalid custom Host Header value. Use domain name format, or save empty to unset custom Host Header." }
);
export type UpdateResourceResponse = Resource;