[GH-ISSUE #5636] [Bug]: Sniffing Settings in Inbound Configuration Are Ignored in Generated Xray Config #3929

Closed
opened 2026-10-31 20:35:58 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @parsa-fathi on GitHub (Jun 28, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5636

Describe the bug

Title: Sniffing Settings in Inbound Configuration Are Ignored in Generated Xray Config

Description:

I found an issue with the sniffing configuration in the 3x-ui panel.

When creating an inbound (for example, a VLESS inbound) and enabling Sniffing, the options selected in the panel do not appear to affect the final generated Xray configuration.

For example, if I enable sniffing and select only HTTP in the UI, the generated configuration still contains:

"sniffing": {
    "destOverride": [
        "http",
        "tls",
        "quic"
    ],
    "enabled": true
}

Regardless of which sniffing options are selected in the panel, the generated configuration always includes all three protocols (http, tls, and quic) in destOverride.

Steps to Reproduce:

  1. Create a new inbound (e.g., VLESS).
  2. Enable Sniffing.
  3. Select only one protocol (e.g., HTTP) in the sniffing settings.
  4. Save the inbound.
  5. Check the generated Xray configuration.

Expected Behavior:

The generated sniffing.destOverride field should reflect the options selected in the panel. For example, if only HTTP is selected:

"sniffing": {
    "destOverride": [
        "http"
    ],
    "enabled": true
}

Actual Behavior:

The generated configuration always contains:

"destOverride": [
    "http",
    "tls",
    "quic"
]

regardless of the settings chosen in the UI.

Additional Notes:

If these sniffing options are intentionally forced by the application and cannot be customized, the current UI is misleading because it suggests that the user can control the individual sniffing protocols.

In that case, it may be better to remove the protocol selection menu entirely. Otherwise, if the options are intended to be configurable, there appears to be a bug causing the selected settings to be ignored.

How to reproduce the problem

  1. Create a new inbound (e.g., VLESS).
  2. Enable Sniffing.
  3. Select only one protocol (e.g., HTTP) in the sniffing settings.
  4. Save the inbound.
  5. Check the generated Xray configuration.

Expected behavior

No response

Actual behavior

No response

Relevant logs


Screenshots

No response

3x-ui version

3.4.1

Xray-core version

26.6.22

How did you install 3x-ui?

install.sh script

Operating system

Ubuntu 26.04 LTS

Which parts of the panel are affected?

No response

Browser (only if it is a UI bug)

No response

Is the panel behind a reverse proxy or CDN?

None

Before submitting

  • I searched existing issues and this bug has not been reported.
  • I am running the latest released version of 3x-ui (or have verified the bug still exists on it).
  • This bug report is written in English.
  • I have redacted any sensitive data (tokens, real domains, client UUIDs).
Originally created by @parsa-fathi on GitHub (Jun 28, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5636 ### Describe the bug **Title:** Sniffing Settings in Inbound Configuration Are Ignored in Generated Xray Config **Description:** I found an issue with the sniffing configuration in the 3x-ui panel. When creating an inbound (for example, a VLESS inbound) and enabling **Sniffing**, the options selected in the panel do not appear to affect the final generated Xray configuration. For example, if I enable sniffing and select only **HTTP** in the UI, the generated configuration still contains: ```json "sniffing": { "destOverride": [ "http", "tls", "quic" ], "enabled": true } ``` Regardless of which sniffing options are selected in the panel, the generated configuration always includes all three protocols (`http`, `tls`, and `quic`) in `destOverride`. **Steps to Reproduce:** 1. Create a new inbound (e.g., VLESS). 2. Enable Sniffing. 3. Select only one protocol (e.g., HTTP) in the sniffing settings. 4. Save the inbound. 5. Check the generated Xray configuration. **Expected Behavior:** The generated `sniffing.destOverride` field should reflect the options selected in the panel. For example, if only HTTP is selected: ```json "sniffing": { "destOverride": [ "http" ], "enabled": true } ``` **Actual Behavior:** The generated configuration always contains: ```json "destOverride": [ "http", "tls", "quic" ] ``` regardless of the settings chosen in the UI. **Additional Notes:** If these sniffing options are intentionally forced by the application and cannot be customized, the current UI is misleading because it suggests that the user can control the individual sniffing protocols. In that case, it may be better to remove the protocol selection menu entirely. Otherwise, if the options are intended to be configurable, there appears to be a bug causing the selected settings to be ignored. ### How to reproduce the problem 1. Create a new inbound (e.g., VLESS). 2. Enable Sniffing. 3. Select only one protocol (e.g., HTTP) in the sniffing settings. 4. Save the inbound. 5. Check the generated Xray configuration. ### Expected behavior _No response_ ### Actual behavior _No response_ ### Relevant logs ```shell ``` ### Screenshots _No response_ ### 3x-ui version 3.4.1 ### Xray-core version 26.6.22 ### How did you install 3x-ui? install.sh script ### Operating system Ubuntu 26.04 LTS ### Which parts of the panel are affected? _No response_ ### Browser (only if it is a UI bug) _No response_ ### Is the panel behind a reverse proxy or CDN? None ### Before submitting - [x] I searched [existing issues](../issues?q=is%3Aissue) and this bug has not been reported. - [x] I am running the latest released version of 3x-ui (or have verified the bug still exists on it). - [x] This bug report is written in English. - [x] I have redacted any sensitive data (tokens, real domains, client UUIDs).
bsakaguchi 2026-10-31 20:35:58 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@github-actions[bot] commented on GitHub (Jun 28, 2026):

I traced the full sniffing pipeline against the v3.4.1 source and found a key discrepancy worth noting before diagnosing further.

What the code does

The sniffing value is stored verbatim: the frontend serialises the form selection in normalizeSniffing() (frontend/src/lib/xray/inbound-form-adapter.ts:255), POSTs it as a JSON string, and the Go model stores it unchanged in the sniffing DB column. Config generation in GenXrayInboundConfig() (internal/database/model/model.go:276) passes i.Sniffing directly to the Xray config struct — no transformation, no hardcoding. The pipeline is correct in the current source.

The fakedns discrepancy

The current Zod schema (frontend/src/schemas/primitives/sniffing.ts:8) defines the default destOverride as ['http', 'tls', 'quic', 'fakedns']. Your report shows ['http', 'tls', 'quic'] — fakedns is absent. If the bug were "the UI always submits the Zod defaults regardless of selection," the generated config would contain all four values including fakedns. The absence of fakedns means one of the following is more likely:

  • The inbound row in the DB was created by an older panel version that did not include fakedns in the default, and the edit is not persisting (for a reason described below).
  • The browser is serving cached frontend assets from an older release. Vite emits content-hashed JS bundles, so a stale index.html in browser cache can cause the old JS to be loaded — clear the browser cache and reload the panel to rule this out.

The config.json file is not the live config

3x-ui writes config.json (under the binary folder, e.g. /usr/local/x-ui/bin/config.json) only at Xray process start. After that, inbound additions and edits are pushed to the running Xray instance via gRPC without rewriting the file. If you are reading config.json directly, it will show the config from the last Xray restart, not the result of subsequent edits.

To see the config that actually reflects the current DB state, use the panel API:

GET /panel/api/server/getConfigJson

or call it from the server:

curl -s -b "session=<your-session-cookie>" http://127.0.0.1:<port>/<base-path>/panel/api/server/getConfigJson | python3 -m json.tool

Steps to confirm the root cause

  1. After saving with only HTTP selected, check the actual DB row:

    sqlite3 /etc/x-ui/x-ui.db "SELECT sniffing FROM inbounds WHERE tag='<your-inbound-tag>';"
    

    If sniffing still contains the old ["http","tls","quic"], the save is silently not persisting.

  2. Reopen the inbound in the panel UI. Does the Sniffing tab still show the selection you made, or has it reverted?

  3. Confirm whether you are reading config.json from disk or using the /panel/api/server/getConfigJson endpoint.

  4. Clear the browser cache completely and retry the steps to rule out a stale JS bundle.

Please share the results of these checks — particularly the raw DB value and whether you are reading the file or the API — so the root cause can be pinned down.

This reply was generated automatically; a maintainer may follow up.

<!-- gh-comment-id:4826558600 --> @github-actions[bot] commented on GitHub (Jun 28, 2026): I traced the full sniffing pipeline against the v3.4.1 source and found a key discrepancy worth noting before diagnosing further. **What the code does** The sniffing value is stored verbatim: the frontend serialises the form selection in `normalizeSniffing()` (`frontend/src/lib/xray/inbound-form-adapter.ts:255`), POSTs it as a JSON string, and the Go model stores it unchanged in the `sniffing` DB column. Config generation in `GenXrayInboundConfig()` (`internal/database/model/model.go:276`) passes `i.Sniffing` directly to the Xray config struct — no transformation, no hardcoding. The pipeline is correct in the current source. **The `fakedns` discrepancy** The current Zod schema (`frontend/src/schemas/primitives/sniffing.ts:8`) defines the default `destOverride` as `['http', 'tls', 'quic', 'fakedns']`. Your report shows `['http', 'tls', 'quic']` — `fakedns` is absent. If the bug were "the UI always submits the Zod defaults regardless of selection," the generated config would contain all four values including `fakedns`. The absence of `fakedns` means one of the following is more likely: - The inbound row in the DB was created by an older panel version that did not include `fakedns` in the default, and the edit is not persisting (for a reason described below). - The browser is serving cached frontend assets from an older release. Vite emits content-hashed JS bundles, so a stale `index.html` in browser cache can cause the old JS to be loaded — clear the browser cache and reload the panel to rule this out. **The `config.json` file is not the live config** 3x-ui writes `config.json` (under the binary folder, e.g. `/usr/local/x-ui/bin/config.json`) only at Xray process start. After that, inbound additions and edits are pushed to the running Xray instance via gRPC without rewriting the file. If you are reading `config.json` directly, it will show the config from the last Xray restart, not the result of subsequent edits. To see the config that actually reflects the current DB state, use the panel API: ``` GET /panel/api/server/getConfigJson ``` or call it from the server: ```bash curl -s -b "session=<your-session-cookie>" http://127.0.0.1:<port>/<base-path>/panel/api/server/getConfigJson | python3 -m json.tool ``` **Steps to confirm the root cause** 1. After saving with only HTTP selected, check the actual DB row: ```bash sqlite3 /etc/x-ui/x-ui.db "SELECT sniffing FROM inbounds WHERE tag='<your-inbound-tag>';" ``` If `sniffing` still contains the old `["http","tls","quic"]`, the save is silently not persisting. 2. Reopen the inbound in the panel UI. Does the Sniffing tab still show the selection you made, or has it reverted? 3. Confirm whether you are reading `config.json` from disk or using the `/panel/api/server/getConfigJson` endpoint. 4. Clear the browser cache completely and retry the steps to rule out a stale JS bundle. Please share the results of these checks — particularly the raw DB value and whether you are reading the file or the API — so the root cause can be pinned down. *This reply was generated automatically; a maintainer may follow up.*
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#3929
No description provided.