Create Basic Auth protected route (domain or path-level)
Authentication configuration
Auth-protected route
// Domain-level auth (entire domain protected)const route = createBasicAuthRoute({ host: "admin.localhost", accounts: [ { username: "admin", password: "$2a$14$..." }, { username: "superadmin", password: "$2a$14$..." }, ], upstream: "admin-backend:8080", realm: "Admin Dashboard",}); Copy
// Domain-level auth (entire domain protected)const route = createBasicAuthRoute({ host: "admin.localhost", accounts: [ { username: "admin", password: "$2a$14$..." }, { username: "superadmin", password: "$2a$14$..." }, ], upstream: "admin-backend:8080", realm: "Admin Dashboard",});
// Path-level auth (specific paths protected)const route = createBasicAuthRoute({ host: "api.localhost", path: "/admin/*", accounts: [{ username: "apiuser", password: "$2a$14$..." }], upstream: "api-backend:8080", realm: "API Admin",}); Copy
// Path-level auth (specific paths protected)const route = createBasicAuthRoute({ host: "api.localhost", path: "/admin/*", accounts: [{ username: "apiuser", password: "$2a$14$..." }], upstream: "api-backend:8080", realm: "API Admin",});
Create Basic Auth protected route (domain or path-level)