mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-20 02:58:53 +00:00
refactor: enhance middleware removal logic in Traefik configuration
This commit is contained in:
@@ -195,6 +195,10 @@ export const removePathMiddlewares = async (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!config) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const { appName } = app;
|
const { appName } = app;
|
||||||
|
|
||||||
if (config.http?.middlewares) {
|
if (config.http?.middlewares) {
|
||||||
@@ -205,13 +209,12 @@ export const removePathMiddlewares = async (
|
|||||||
delete config.http.middlewares[stripPrefixMiddleware];
|
delete config.http.middlewares[stripPrefixMiddleware];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config?.http?.middlewares) {
|
if (
|
||||||
// traefik will fail to start if the file contains middlewares entry but no middlewares are defined
|
config?.http?.middlewares &&
|
||||||
const hasNoMiddlewares = Object.keys(config.http.middlewares).length === 0;
|
Object.keys(config.http.middlewares).length === 0
|
||||||
if (hasNoMiddlewares) {
|
) {
|
||||||
// if there aren't any middlewares, remove the whole section
|
// if there aren't any middlewares, remove the whole section
|
||||||
delete config.http.middlewares;
|
delete config.http.middlewares;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// // If http section is empty, remove it completely
|
// // If http section is empty, remove it completely
|
||||||
|
|||||||
Reference in New Issue
Block a user