mirror of
https://github.com/fosrl/pangolin.git
synced 2026-05-26 10:43:09 +00:00
Update traefik config
This commit is contained in:
@@ -100,6 +100,7 @@ export async function getTraefikConfig(
|
|||||||
headers: resources.headers,
|
headers: resources.headers,
|
||||||
proxyProtocol: resources.proxyProtocol,
|
proxyProtocol: resources.proxyProtocol,
|
||||||
proxyProtocolVersion: resources.proxyProtocolVersion,
|
proxyProtocolVersion: resources.proxyProtocolVersion,
|
||||||
|
wildcard: resources.wildcard,
|
||||||
|
|
||||||
maintenanceModeEnabled: resources.maintenanceModeEnabled,
|
maintenanceModeEnabled: resources.maintenanceModeEnabled,
|
||||||
maintenanceModeType: resources.maintenanceModeType,
|
maintenanceModeType: resources.maintenanceModeType,
|
||||||
@@ -238,6 +239,7 @@ export async function getTraefikConfig(
|
|||||||
priority: priority, // may be null, we fallback later
|
priority: priority, // may be null, we fallback later
|
||||||
domainCertResolver: row.domainCertResolver,
|
domainCertResolver: row.domainCertResolver,
|
||||||
preferWildcardCert: row.preferWildcardCert,
|
preferWildcardCert: row.preferWildcardCert,
|
||||||
|
wildcard: row.wildcard,
|
||||||
|
|
||||||
maintenanceModeEnabled: row.maintenanceModeEnabled,
|
maintenanceModeEnabled: row.maintenanceModeEnabled,
|
||||||
maintenanceModeType: row.maintenanceModeType,
|
maintenanceModeType: row.maintenanceModeType,
|
||||||
@@ -376,7 +378,16 @@ export async function getTraefikConfig(
|
|||||||
...additionalMiddlewares
|
...additionalMiddlewares
|
||||||
];
|
];
|
||||||
|
|
||||||
let rule = `Host(\`${fullDomain}\`)`;
|
let rule: string;
|
||||||
|
if (resource.wildcard && fullDomain.startsWith("*.")) {
|
||||||
|
// Convert *.foo.bar.com -> HostRegexp(`^[^.]+\.foo\.bar\.com$`)
|
||||||
|
const escaped = fullDomain
|
||||||
|
.slice(2) // remove leading "*."
|
||||||
|
.replace(/\./g, "\\.");
|
||||||
|
rule = `HostRegexp(\`^[^.]+\\.${escaped}$\`)`;
|
||||||
|
} else {
|
||||||
|
rule = `Host(\`${fullDomain}\`)`;
|
||||||
|
}
|
||||||
|
|
||||||
// priority logic
|
// priority logic
|
||||||
let priority: number;
|
let priority: number;
|
||||||
@@ -566,7 +577,7 @@ export async function getTraefikConfig(
|
|||||||
resource.ssl ? entrypointHttps : entrypointHttp
|
resource.ssl ? entrypointHttps : entrypointHttp
|
||||||
],
|
],
|
||||||
service: maintenanceServiceName,
|
service: maintenanceServiceName,
|
||||||
rule: `Host(\`${fullDomain}\`) && (PathPrefix(\`/_next\`) || PathRegexp(\`^/__nextjs*\`))`,
|
rule: `${rule} && (PathPrefix(\`/_next\`) || PathRegexp(\`^/__nextjs*\`))`,
|
||||||
priority: 2001,
|
priority: 2001,
|
||||||
...(resource.ssl ? { tls } : {})
|
...(resource.ssl ? { tls } : {})
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user