Merge pull request #1592 from Pallavikumarimdb/ordered-priority-in-path-routing-rules

Add ordered priority for path-based routing rules
This commit is contained in:
Owen Schwartz
2025-10-05 17:10:26 -07:00
committed by GitHub
11 changed files with 199 additions and 38 deletions

View File

@@ -114,7 +114,8 @@ export async function updateProxyResources(
path: targetData.path,
pathMatchType: targetData["path-match"],
rewritePath: targetData.rewritePath,
rewritePathType: targetData["rewrite-match"]
rewritePathType: targetData["rewrite-match"],
priority: targetData.priority
})
.returning();
@@ -363,7 +364,8 @@ export async function updateProxyResources(
path: targetData.path,
pathMatchType: targetData["path-match"],
rewritePath: targetData.rewritePath,
rewritePathType: targetData["rewrite-match"]
rewritePathType: targetData["rewrite-match"],
priority: targetData.priority
})
.where(eq(targets.targetId, existingTarget.targetId))
.returning();

View File

@@ -33,7 +33,8 @@ export const TargetSchema = z.object({
"path-match": z.enum(["exact", "prefix", "regex"]).optional().nullable(),
healthcheck: TargetHealthCheckSchema.optional(),
rewritePath: z.string().optional(),
"rewrite-match": z.enum(["exact", "prefix", "regex", "stripPrefix"]).optional().nullable()
"rewrite-match": z.enum(["exact", "prefix", "regex", "stripPrefix"]).optional().nullable(),
priority: z.number().int().min(1).max(1000).optional().default(100)
});
export type TargetData = z.infer<typeof TargetSchema>;