|
@@ -59,20 +59,17 @@ import {
|
|
SettingsSectionTitle,
|
|
SettingsSectionTitle,
|
|
SettingsSectionDescription,
|
|
SettingsSectionDescription,
|
|
SettingsSectionBody,
|
|
SettingsSectionBody,
|
|
- SettingsSectionForm,
|
|
|
|
SettingsSectionFooter
|
|
SettingsSectionFooter
|
|
} from "@app/components/Settings";
|
|
} from "@app/components/Settings";
|
|
import { SwitchInput } from "@app/components/SwitchInput";
|
|
import { SwitchInput } from "@app/components/SwitchInput";
|
|
|
|
|
|
const addTargetSchema = z.object({
|
|
const addTargetSchema = z.object({
|
|
- ip: z.string().ip(),
|
|
|
|
|
|
+ ip: z.string().ip().or(z.literal('localhost')),
|
|
method: z.string(),
|
|
method: z.string(),
|
|
port: z.coerce.number().int().positive()
|
|
port: z.coerce.number().int().positive()
|
|
// protocol: z.string(),
|
|
// protocol: z.string(),
|
|
});
|
|
});
|
|
|
|
|
|
-type AddTargetFormValues = z.infer<typeof addTargetSchema>;
|
|
|
|
-
|
|
|
|
type LocalTarget = Omit<
|
|
type LocalTarget = Omit<
|
|
ArrayElement<ListTargetsResponse["targets"]> & {
|
|
ArrayElement<ListTargetsResponse["targets"]> & {
|
|
new?: boolean;
|
|
new?: boolean;
|
|
@@ -182,7 +179,7 @@ export default function ReverseProxyTargets(props: {
|
|
// make sure that the target IP is within the site subnet
|
|
// make sure that the target IP is within the site subnet
|
|
const targetIp = data.ip;
|
|
const targetIp = data.ip;
|
|
const subnet = site.subnet;
|
|
const subnet = site.subnet;
|
|
- if (!isIPInSubnet(targetIp, subnet)) {
|
|
|
|
|
|
+ if (targetIp === "localhost" || !isIPInSubnet(targetIp, subnet)) {
|
|
toast({
|
|
toast({
|
|
variant: "destructive",
|
|
variant: "destructive",
|
|
title: "Invalid target IP",
|
|
title: "Invalid target IP",
|