mirror of
https://github.com/fosrl/pangolin.git
synced 2025-08-04 01:55:10 +02:00
Add ability for sticky sessions to backend resource.
This commit is contained in:
parent
8b0c30f19f
commit
ac8e315fbd
6 changed files with 99 additions and 9 deletions
|
@ -42,7 +42,8 @@ const updateHttpResourceBodySchema = z
|
|||
isBaseDomain: z.boolean().optional(),
|
||||
applyRules: z.boolean().optional(),
|
||||
domainId: z.string().optional(),
|
||||
enabled: z.boolean().optional()
|
||||
enabled: z.boolean().optional(),
|
||||
stickySession: z.boolean().optional()
|
||||
})
|
||||
.strict()
|
||||
.refine((data) => Object.keys(data).length > 0, {
|
||||
|
|
|
@ -40,7 +40,8 @@ export async function traefikConfigProvider(
|
|||
org: {
|
||||
orgId: orgs.orgId
|
||||
},
|
||||
enabled: resources.enabled
|
||||
enabled: resources.enabled,
|
||||
stickySession: resources.stickySession
|
||||
})
|
||||
.from(resources)
|
||||
.innerJoin(sites, eq(sites.siteId, resources.siteId))
|
||||
|
@ -275,7 +276,18 @@ export async function traefikConfigProvider(
|
|||
url: `${target.method}://${ip}:${target.internalPort}`
|
||||
};
|
||||
}
|
||||
})
|
||||
}),
|
||||
...(resource.stickySession
|
||||
? {
|
||||
sticky: {
|
||||
cookie: {
|
||||
name: "pangolin_sticky",
|
||||
secure: resource.ssl,
|
||||
httpOnly: true
|
||||
}
|
||||
}
|
||||
}
|
||||
: {})
|
||||
}
|
||||
};
|
||||
} else {
|
||||
|
@ -335,7 +347,18 @@ export async function traefikConfigProvider(
|
|||
address: `${ip}:${target.internalPort}`
|
||||
};
|
||||
}
|
||||
})
|
||||
}),
|
||||
...(resource.stickySession
|
||||
? {
|
||||
sticky: {
|
||||
cookie: {
|
||||
name: "pangolin_sticky",
|
||||
secure: resource.ssl,
|
||||
httpOnly: true
|
||||
}
|
||||
}
|
||||
}
|
||||
: {})
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue