[PR #7095] fix(hosts): let the Host form clear its SNI #6647

Open
opened 2026-11-07 17:31:01 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/7095
Author: @Plus98ir
Created: 11/7/2026
Status: 🔄 Open

Base: main ← Head: fix/host-clear-sni


📝 Commits (1)

  • b0fa20f fix(hosts): let the Host form clear its SNI

📊 Changes

2 files changed (+49 additions, -4 deletions)

View changed files

📝 frontend/src/pages/hosts/HostFormModal.tsx (+2 -4)
➕ frontend/src/test/host-form-sni.test.tsx (+47 -0)

📄 Description

Problem

In Hosts → Edit Host → Security, removing the SNI tag(s) and saving does nothing: the old SNI comes back on the next edit and stays in share links.

HostFormModal keeps a hidden sni field (loaded from the host) next to the editable snis tag list. On save, an empty tag list fell back to that hidden value:

const primarySni = cleanedSnis.length > 0 ? cleanedSnis[0] : rest.sni || '';

so the old SNI was sent again, and the backend (hostSniPool) correctly rebuilt the pool from it.

Fix

The tag list is the only SNI input, so the primary SNI is now cleanedSnis[0] ?? ''. The dynamic ECH helper's hostSni read the same stale value and now uses the tag list too. A host saved with only the legacy sni field still loads, because defaultsFor already seeds snis from it.

Test

frontend/src/test/host-form-sni.test.tsx opens the modal on a host with an SNI, removes the tag, saves, and asserts the payload has sni: ''. Without the fix it fails with "sni": "dash.example.com".


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/MHSanaei/3x-ui/pull/7095 **Author:** [@Plus98ir](https://github.com/Plus98ir) **Created:** 11/7/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/host-clear-sni` --- ### 📝 Commits (1) - [`b0fa20f`](https://github.com/MHSanaei/3x-ui/commit/b0fa20fd7ebe8dcd4da4af2a4105a60241f84959) fix(hosts): let the Host form clear its SNI ### 📊 Changes **2 files changed** (+49 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `frontend/src/pages/hosts/HostFormModal.tsx` (+2 -4) ➕ `frontend/src/test/host-form-sni.test.tsx` (+47 -0) </details> ### 📄 Description ## Problem In **Hosts → Edit Host → Security**, removing the SNI tag(s) and saving does nothing: the old SNI comes back on the next edit and stays in share links. `HostFormModal` keeps a hidden `sni` field (loaded from the host) next to the editable `snis` tag list. On save, an empty tag list fell back to that hidden value: ```ts const primarySni = cleanedSnis.length > 0 ? cleanedSnis[0] : rest.sni || ''; ``` so the old SNI was sent again, and the backend (`hostSniPool`) correctly rebuilt the pool from it. ## Fix The tag list is the only SNI input, so the primary SNI is now `cleanedSnis[0] ?? ''`. The dynamic ECH helper's `hostSni` read the same stale value and now uses the tag list too. A host saved with only the legacy `sni` field still loads, because `defaultsFor` already seeds `snis` from it. ## Test `frontend/src/test/host-form-sni.test.tsx` opens the modal on a host with an SNI, removes the tag, saves, and asserts the payload has `sni: ''`. Without the fix it fails with `"sni": "dash.example.com"`. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#6647
No description provided.