diff --git a/web/html/modals/xray_rule_modal.html b/web/html/modals/xray_rule_modal.html
index 487bf197..e6a8bf46 100644
--- a/web/html/modals/xray_rule_modal.html
+++ b/web/html/modals/xray_rule_modal.html
@@ -219,14 +219,14 @@
rule = {};
newRule = {};
rule.type = "field";
- rule.domain = value.domain.length > 0 ? value.domain.split(',') : [];
- rule.ip = value.ip.length > 0 ? value.ip.split(',') : [];
+ rule.domain = value.domain.length > 0 ? value.domain.split(',').map(s => s.trim()) : [];
+ rule.ip = value.ip.length > 0 ? value.ip.split(',').map(s => s.trim()) : [];
rule.port = value.port;
rule.sourcePort = value.sourcePort;
rule.vlessRoute = value.vlessRoute;
rule.network = value.network;
- rule.sourceIP = value.sourceIP.length > 0 ? value.sourceIP.split(',') : [];
- rule.user = value.user.length > 0 ? value.user.split(',') : [];
+ rule.sourceIP = value.sourceIP.length > 0 ? value.sourceIP.split(',').map(s => s.trim()) : [];
+ rule.user = value.user.length > 0 ? value.user.split(',').map(s => s.trim()) : [];
rule.inboundTag = value.inboundTag;
rule.protocol = value.protocol;
rule.attrs = Object.fromEntries(value.attrs);