diff --git a/server/routers/target/createTarget.ts b/server/routers/target/createTarget.ts index 1aef3251..b35d8d2a 100644 --- a/server/routers/target/createTarget.ts +++ b/server/routers/target/createTarget.ts @@ -163,12 +163,8 @@ export async function createTarget( ); if (existingTarget) { - return next( - createHttpError( - HttpCode.BAD_REQUEST, - `Target with IP ${targetData.ip}, port ${targetData.port}, method ${targetData.method} already exists for resource ID ${resourceId}` - ) - ); + // log a warning + logger.warn(`Target with IP ${targetData.ip}, port ${targetData.port}, method ${targetData.method} already exists for resource ID ${resourceId}`); } let newTarget: Target[] = []; diff --git a/server/routers/target/updateTarget.ts b/server/routers/target/updateTarget.ts index d332609d..6e9a8fc9 100644 --- a/server/routers/target/updateTarget.ts +++ b/server/routers/target/updateTarget.ts @@ -170,12 +170,8 @@ export async function updateTarget( ); if (foundTarget) { - return next( - createHttpError( - HttpCode.BAD_REQUEST, - `Target with IP ${targetData.ip}, port ${targetData.port}, and method ${targetData.method} already exists on the same site.` - ) - ); + // log a warning + logger.warn(`Target with IP ${targetData.ip}, port ${targetData.port}, method ${targetData.method} already exists for resource ID ${target.resourceId}`); } const { internalPort, targetIps } = await pickPort(site.siteId!, db); diff --git a/src/app/[orgId]/settings/resources/[niceId]/proxy/page.tsx b/src/app/[orgId]/settings/resources/[niceId]/proxy/page.tsx index 158726fe..aa268250 100644 --- a/src/app/[orgId]/settings/resources/[niceId]/proxy/page.tsx +++ b/src/app/[orgId]/settings/resources/[niceId]/proxy/page.tsx @@ -501,25 +501,6 @@ export default function ReverseProxyTargets(props: { return; } - // Check if target with same IP, port and method already exists - const isDuplicate = targets.some( - (t) => - t.targetId !== target.targetId && - t.ip === target.ip && - t.port === target.port && - t.method === target.method && - t.siteId === target.siteId - ); - - if (isDuplicate) { - toast({ - variant: "destructive", - title: t("targetErrorDuplicate"), - description: t("targetErrorDuplicateDescription") - }); - return; - } - try { setTargetsLoading(true); @@ -585,24 +566,6 @@ export default function ReverseProxyTargets(props: { } async function addTarget(data: z.infer) { - // Check if target with same IP, port and method already exists - const isDuplicate = targets.some( - (target) => - target.ip === data.ip && - target.port === data.port && - target.method === data.method && - target.siteId === data.siteId - ); - - if (isDuplicate) { - toast({ - variant: "destructive", - title: t("targetErrorDuplicate"), - description: t("targetErrorDuplicateDescription") - }); - return; - } - // if (site && site.type == "wireguard" && site.subnet) { // // make sure that the target IP is within the site subnet // const targetIp = data.ip; @@ -899,7 +862,7 @@ export default function ReverseProxyTargets(props: { const healthCheckColumn: ColumnDef = { accessorKey: "healthCheck", - header: t("healthCheck"), + header: () => ({t("healthCheck")}), cell: ({ row }) => { const status = row.original.hcHealth || "unknown"; const isEnabled = row.original.hcEnabled; @@ -971,7 +934,7 @@ export default function ReverseProxyTargets(props: { const matchPathColumn: ColumnDef = { accessorKey: "path", - header: t("matchPath"), + header: () => ({t("matchPath")}), cell: ({ row }) => { const hasPathMatch = !!( row.original.path || row.original.pathMatchType @@ -1033,7 +996,7 @@ export default function ReverseProxyTargets(props: { const addressColumn: ColumnDef = { accessorKey: "address", - header: t("address"), + header: () => ({t("address")}), cell: ({ row }) => { const selectedSite = sites.find( (site) => site.siteId === row.original.siteId @@ -1052,7 +1015,7 @@ export default function ReverseProxyTargets(props: { return (
-
+
{selectedSite && selectedSite.type === "newt" && (() => { @@ -1247,7 +1210,7 @@ export default function ReverseProxyTargets(props: { const rewritePathColumn: ColumnDef = { accessorKey: "rewritePath", - header: t("rewritePath"), + header: () => ({t("rewritePath")}), cell: ({ row }) => { const hasRewritePath = !!( row.original.rewritePath || row.original.rewritePathType @@ -1317,7 +1280,7 @@ export default function ReverseProxyTargets(props: { const enabledColumn: ColumnDef = { accessorKey: "enabled", - header: t("enabled"), + header: () => ({t("enabled")}), cell: ({ row }) => (
= { id: "actions", + header: () => ({t("actions")}), cell: ({ row }) => ( -
+