[GH-ISSUE #6317] [Bug]: Client HWIDS API doesn`t response #4290

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

Originally created by @kerya2 on GitHub (Aug 25, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6317

Describe the bug

If I ask API about clients hwids it doesnt response, but if I ask API about client it response.

How to reproduce the problem

Just ask API /panel/api/clients/hwid/{email}

Expected behavior

No response

Actual behavior

No response

Relevant logs


Screenshots

No response

3x-ui version

3.7.0

Xray-core version

26.7.28

How did you install 3x-ui?

install.sh script

Operating system

Ubuntu 22.04.5 LTS x86_64

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 @kerya2 on GitHub (Aug 25, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6317 ### Describe the bug If I ask API about client`s hwids it doesn`t response, but if I ask API about client it response. ### How to reproduce the problem Just ask API /panel/api/clients/hwid/{email} ### Expected behavior _No response_ ### Actual behavior _No response_ ### Relevant logs ```shell ``` ### Screenshots _No response_ ### 3x-ui version 3.7.0 ### Xray-core version 26.7.28 ### How did you install 3x-ui? install.sh script ### Operating system Ubuntu 22.04.5 LTS x86_64 ### 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:38:35 +07:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@github-actions[bot] commented on GitHub (Aug 25, 2026):

The endpoint you called does not exist: the path is hwids (plural), not hwid, and it is a POST, not a GET. That is why you get "no response" — an unmatched /panel/api/... path is terminated by c.AbortWithStatus(http.StatusNotFound) in internal/web/web.go:278, which writes a bare 404 with an empty body, so a client that only prints the body shows nothing.

The three HWID routes, registered in internal/web/controller/client.go:79-81:

g.POST("/hwids/:email", a.getHwids)
g.DELETE("/hwids/:email", a.clearHwids)
g.DELETE("/hwids/:email/:id", a.deleteHwid)

Under the /panel/api/clients group (internal/web/controller/api.go:182) that resolves to POST /panel/api/clients/hwids/{email}. Working call, with a Bearer token from Settings → Security → API Token:

curl -sS -X POST \
  -H "Authorization: Bearer <token>" \
  "https://<host>:<port>/<webBasePath>/panel/api/clients/hwids/alice%40example.com"

Three more things that produce the same empty-body symptom, so you can rule them out:

  1. Wrong method on the right path. The engine is gin.Default() (internal/web/web.go:164), so HandleMethodNotAllowed is off — a GET on /clients/hwids/{email} also falls through to the same empty 404 instead of a 405.
  2. Not authenticated. checkAPIAuth answers an unauthenticated request with c.AbortWithStatus(http.StatusNotFound) unless the caller sends X-Requested-With: XMLHttpRequest (internal/web/controller/api.go:63-69) — again an empty 404, not a JSON error.
  3. Session cookie without a CSRF token. CSRFMiddleware aborts unsafe methods with an empty 403 (internal/web/middleware/security.go:51-53). A Bearer token sets api_authed and skips that check entirely (security.go:43-46), which is why token auth is the simpler path for scripts.

Once you hit the right route, note that obj can legitimately be null: ListClientHwids returns early when the client has no subId (internal/web/service/client_hwid.go:164-167), and rows are only created when the client actually fetches its subscription with HWID headers and limitHwid > 0 (EnforceHwidForSubID, client_hwid.go:92-95). A client that has never used a HWID-capable app has an empty list.

The endpoints are documented at POST /panel/api/clients/hwids/:email in frontend/src/pages/api-docs/endpoints.ts:1202-1207 and in the panel's own API Docs page (/panel/api-docs); nothing in the repository ever exposed a singular clients/hwid/ path.

Closing as a configuration/usage issue and relabelling from bug to question. If the plural POST form above still returns nothing for you, please reply with the exact command and the HTTP status code (curl -i) and this can be reopened.

Verdict: Not a bug (user configuration)
Severity: N/A
Confidence: High
Root cause: No defect. The requested path /panel/api/clients/hwid/{email} is not registered; the routes are POST|DELETE /panel/api/clients/hwids/:email (internal/web/controller/client.go:79-81). The empty response is engine.NoRoute → c.AbortWithStatus(http.StatusNotFound) at internal/web/web.go:278, which emits no body.
Already fixed: Not applicable — 3.7.0 is the current release (gh release list), and the routes are unchanged since 1250fbb7 "feat(clients): allow removing a single HWID device (#6265)" / 694ad6de "feat(sub): add per-client subscription HWID limits (#5802)".
Duplicate of: None
Evidence: internal/web/controller/client.go:79 g.POST("/hwids/:email", a.getHwids); internal/web/controller/api.go:182 clients := api.Group("/clients"); internal/web/web.go:278 c.AbortWithStatus(http.StatusNotFound); internal/web/controller/spa.go:108-110 excludes /panel/api/ from the SPA fallback, so API misses get the bare 404; internal/web/web.go:164 engine := gin.Default() (no HandleMethodNotAllowed); internal/web/middleware/security.go:43-53 (Bearer skips CSRF, otherwise empty 403); internal/web/service/client_hwid.go:164-167 returns nil, nil when subID == ""; frontend/src/hooks/useClientHwids.ts:22-24 — the panel UI itself POSTs to /panel/api/clients/hwids/${email}; frontend/src/pages/api-docs/endpoints.ts:1202-1224, pinned both ways by TestRouteRegistryContract (internal/web/routes_contract_test.go:109). A repo-wide grep for clients/hwid not followed by s returns no route or doc.
Not determined: Whether the reporter literally sent the singular path or mistyped it in the report; a curl -i against POST /panel/api/clients/hwids/{email} with the status line would settle it.

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

<!-- gh-comment-id:5408007480 --> @github-actions[bot] commented on GitHub (Aug 25, 2026): The endpoint you called does not exist: the path is `hwids` (plural), not `hwid`, and it is a **POST**, not a GET. That is why you get "no response" — an unmatched `/panel/api/...` path is terminated by `c.AbortWithStatus(http.StatusNotFound)` in `internal/web/web.go:278`, which writes a bare 404 with an **empty body**, so a client that only prints the body shows nothing. The three HWID routes, registered in `internal/web/controller/client.go:79-81`: ```go g.POST("/hwids/:email", a.getHwids) g.DELETE("/hwids/:email", a.clearHwids) g.DELETE("/hwids/:email/:id", a.deleteHwid) ``` Under the `/panel/api/clients` group (`internal/web/controller/api.go:182`) that resolves to `POST /panel/api/clients/hwids/{email}`. Working call, with a Bearer token from Settings → Security → API Token: ```bash curl -sS -X POST \ -H "Authorization: Bearer <token>" \ "https://<host>:<port>/<webBasePath>/panel/api/clients/hwids/alice%40example.com" ``` Three more things that produce the same empty-body symptom, so you can rule them out: 1. **Wrong method on the right path.** The engine is `gin.Default()` (`internal/web/web.go:164`), so `HandleMethodNotAllowed` is off — a `GET` on `/clients/hwids/{email}` also falls through to the same empty 404 instead of a 405. 2. **Not authenticated.** `checkAPIAuth` answers an unauthenticated request with `c.AbortWithStatus(http.StatusNotFound)` unless the caller sends `X-Requested-With: XMLHttpRequest` (`internal/web/controller/api.go:63-69`) — again an empty 404, not a JSON error. 3. **Session cookie without a CSRF token.** `CSRFMiddleware` aborts unsafe methods with an empty 403 (`internal/web/middleware/security.go:51-53`). A `Bearer` token sets `api_authed` and skips that check entirely (`security.go:43-46`), which is why token auth is the simpler path for scripts. Once you hit the right route, note that `obj` can legitimately be `null`: `ListClientHwids` returns early when the client has no `subId` (`internal/web/service/client_hwid.go:164-167`), and rows are only created when the client actually fetches its subscription with HWID headers and `limitHwid > 0` (`EnforceHwidForSubID`, `client_hwid.go:92-95`). A client that has never used a HWID-capable app has an empty list. The endpoints are documented at `POST /panel/api/clients/hwids/:email` in `frontend/src/pages/api-docs/endpoints.ts:1202-1207` and in the panel's own **API Docs** page (`/panel/api-docs`); nothing in the repository ever exposed a singular `clients/hwid/` path. Closing as a configuration/usage issue and relabelling from `bug` to `question`. If the plural POST form above still returns nothing for you, please reply with the exact command and the HTTP status code (`curl -i`) and this can be reopened. Verdict: Not a bug (user configuration) Severity: N/A Confidence: High Root cause: No defect. The requested path `/panel/api/clients/hwid/{email}` is not registered; the routes are `POST|DELETE /panel/api/clients/hwids/:email` (`internal/web/controller/client.go:79-81`). The empty response is `engine.NoRoute` → `c.AbortWithStatus(http.StatusNotFound)` at `internal/web/web.go:278`, which emits no body. Already fixed: Not applicable — 3.7.0 is the current release (`gh release list`), and the routes are unchanged since 1250fbb7 "feat(clients): allow removing a single HWID device (#6265)" / 694ad6de "feat(sub): add per-client subscription HWID limits (#5802)". Duplicate of: None Evidence: `internal/web/controller/client.go:79` `g.POST("/hwids/:email", a.getHwids)`; `internal/web/controller/api.go:182` `clients := api.Group("/clients")`; `internal/web/web.go:278` `c.AbortWithStatus(http.StatusNotFound)`; `internal/web/controller/spa.go:108-110` excludes `/panel/api/` from the SPA fallback, so API misses get the bare 404; `internal/web/web.go:164` `engine := gin.Default()` (no `HandleMethodNotAllowed`); `internal/web/middleware/security.go:43-53` (Bearer skips CSRF, otherwise empty 403); `internal/web/service/client_hwid.go:164-167` returns `nil, nil` when `subID == ""`; `frontend/src/hooks/useClientHwids.ts:22-24` — the panel UI itself POSTs to `/panel/api/clients/hwids/${email}`; `frontend/src/pages/api-docs/endpoints.ts:1202-1224`, pinned both ways by `TestRouteRegistryContract` (`internal/web/routes_contract_test.go:109`). A repo-wide grep for `clients/hwid` not followed by `s` returns no route or doc. Not determined: Whether the reporter literally sent the singular path or mistyped it in the report; a `curl -i` against `POST /panel/api/clients/hwids/{email}` with the status line would settle it. *This reply was generated automatically; a maintainer may follow up.* <!-- claude-issue:analyst -->
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#4290
No description provided.