feat(proxy): support external TLS termination
This commit is contained in:
@@ -52,6 +52,18 @@ export const validateEnvironment = (env) => {
|
||||
errors.push('DOMAIN must be a hostname without a scheme, path, or port');
|
||||
}
|
||||
|
||||
const caddySiteAddress = env.CADDY_SITE_ADDRESS?.trim() ?? '';
|
||||
if (caddySiteAddress) {
|
||||
try {
|
||||
const parsed = new URL(caddySiteAddress);
|
||||
if (!['http:', 'https:'].includes(parsed.protocol) || parsed.hostname !== domain || parsed.pathname !== '/') {
|
||||
errors.push('CADDY_SITE_ADDRESS must be http://DOMAIN or https://DOMAIN');
|
||||
}
|
||||
} catch {
|
||||
errors.push('CADDY_SITE_ADDRESS must be http://DOMAIN or https://DOMAIN');
|
||||
}
|
||||
}
|
||||
|
||||
const email = env.ACME_EMAIL?.trim() ?? '';
|
||||
if (email && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) errors.push('ACME_EMAIL must be a valid email address');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user