diff --git a/web/src/components/Plugin/UI/plugin.tsx b/web/src/components/Plugin/UI/plugin.tsx index d0ea0de869..ed2e8b2906 100644 --- a/web/src/components/Plugin/UI/plugin.tsx +++ b/web/src/components/Plugin/UI/plugin.tsx @@ -70,7 +70,7 @@ export const PluginForm: React.FC = ({ name, schema, renderForm, form }) case 'limit-req': return ; case 'proxy-mirror': - return ; + return case 'limit-conn': return ; case 'referer-restriction': diff --git a/web/src/components/Plugin/UI/proxy-mirror.tsx b/web/src/components/Plugin/UI/proxy-mirror.tsx index e1e9fb051b..a1285bd360 100644 --- a/web/src/components/Plugin/UI/proxy-mirror.tsx +++ b/web/src/components/Plugin/UI/proxy-mirror.tsx @@ -21,6 +21,7 @@ import { useIntl } from 'umi'; type Props = { form: FormInstance; + schema: Record | undefined; }; const FORM_ITEM_LAYOUT = { @@ -32,8 +33,9 @@ const FORM_ITEM_LAYOUT = { }, }; -const ProxyMirror: React.FC = ({ form }) => { +const ProxyMirror: React.FC = ({ form, schema }) => { const { formatMessage } = useIntl(); + const properties = schema?.properties; return (
@@ -44,10 +46,7 @@ const ProxyMirror: React.FC = ({ form }) => { tooltip={formatMessage({ id: 'component.pluginForm.proxy-mirror.host.tooltip' })} rules={[ { - pattern: new RegExp( - /^http(s)?:\/\/[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+(:[0-9]{1,5})?$/, - 'g', - ), + pattern: new RegExp(`${properties.host.pattern}`, 'g'), message: formatMessage({ id: 'component.pluginForm.proxy-mirror.host.ruletip' }), }, ]}