mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
fix: inherit security & redirects from application
This commit is contained in:
@@ -122,13 +122,25 @@ export const createRouterConfig = async (
|
|||||||
if ((entryPoint === "websecure" && https) || !https) {
|
if ((entryPoint === "websecure" && https) || !https) {
|
||||||
// redirects
|
// redirects
|
||||||
for (const redirect of redirects) {
|
for (const redirect of redirects) {
|
||||||
const middlewareName = `redirect-${appName}-${redirect.uniqueConfigKey}`;
|
let middlewareName = `redirect-${appName}-${redirect.uniqueConfigKey}`;
|
||||||
|
if (domain.domainType === "preview") {
|
||||||
|
middlewareName = `redirect-${appName.replace(
|
||||||
|
/^preview-(.+)-[^-]+$/,
|
||||||
|
"$1",
|
||||||
|
)}-${redirect.uniqueConfigKey}`;
|
||||||
|
}
|
||||||
routerConfig.middlewares?.push(middlewareName);
|
routerConfig.middlewares?.push(middlewareName);
|
||||||
}
|
}
|
||||||
|
|
||||||
// security
|
// security
|
||||||
if (security.length > 0) {
|
if (security.length > 0) {
|
||||||
const middlewareName = `auth-${appName}`;
|
let middlewareName = `auth-${appName}`;
|
||||||
|
if (domain.domainType === "preview") {
|
||||||
|
middlewareName = `auth-${appName.replace(
|
||||||
|
/^preview-(.+)-[^-]+$/,
|
||||||
|
"$1",
|
||||||
|
)}`;
|
||||||
|
}
|
||||||
routerConfig.middlewares?.push(middlewareName);
|
routerConfig.middlewares?.push(middlewareName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user