[GH-ISSUE #5242] [Bug] Dashboard 'Clear Offline' button fails with 'Unexpected end of JSON input' #4068

Closed
opened 2026-05-05 14:34:35 -06:00 by gitea-mirror · 1 comment
Owner

Originally created by @mango766 on GitHub (Mar 17, 2026).
Original GitHub issue: https://github.com/fatedier/frp/issues/5242

Bug Description

Clicking the Clear Offline button on the frps dashboard fails with the error:

Failed to clear offline proxies: Failed to execute 'json' on 'Response': Unexpected end of JSON input

This is caused by two related issues:

  1. Backend (pkg/util/http/handler.go): When an API handler returns nil, MakeHTTPHandlerFunc responds with HTTP 200 and an empty body. Per REST conventions, an empty-body response should use 204 No Content instead.

  2. Frontend (web/frps/src/api/http.ts): The request() function unconditionally calls response.json() on any non-204 response. When the response body is empty or lacks a Content-Type: application/json header, the browser throws Unexpected end of JSON input.

Notably, the frpc dashboard's http.ts already checks Content-Type before parsing JSON — the frps dashboard version was missing this same check.

Steps to Reproduce

  1. Start frps with the dashboard enabled
  2. Connect one or more frpc clients, then disconnect them so proxies go offline
  3. Open the frps dashboard, go to the Proxies page
  4. Click Clear Offline → observe the error popup

Expected Behavior

Offline proxies should be cleared successfully with a success toast notification.

Environment

  • frp version: 0.67.0
  • OS: Linux/Windows (reproducible on both)

This was independently reported by at least two users:

Originally created by @mango766 on GitHub (Mar 17, 2026). Original GitHub issue: https://github.com/fatedier/frp/issues/5242 ### Bug Description Clicking the **Clear Offline** button on the frps dashboard fails with the error: > Failed to clear offline proxies: Failed to execute 'json' on 'Response': Unexpected end of JSON input This is caused by two related issues: 1. **Backend (`pkg/util/http/handler.go`)**: When an API handler returns `nil`, `MakeHTTPHandlerFunc` responds with HTTP 200 and an empty body. Per REST conventions, an empty-body response should use 204 No Content instead. 2. **Frontend (`web/frps/src/api/http.ts`)**: The `request()` function unconditionally calls `response.json()` on any non-204 response. When the response body is empty or lacks a `Content-Type: application/json` header, the browser throws `Unexpected end of JSON input`. Notably, the frpc dashboard's `http.ts` already checks `Content-Type` before parsing JSON — the frps dashboard version was missing this same check. ### Steps to Reproduce 1. Start `frps` with the dashboard enabled 2. Connect one or more `frpc` clients, then disconnect them so proxies go offline 3. Open the frps dashboard, go to the Proxies page 4. Click **Clear Offline** → observe the error popup ### Expected Behavior Offline proxies should be cleared successfully with a success toast notification. ### Environment - frp version: 0.67.0 - OS: Linux/Windows (reproducible on both) ### Related This was independently reported by at least two users: - #5233 - #5236
Author
Owner

@fatedier commented on GitHub (Mar 20, 2026):

Fixed in v0.68.0.

<!-- gh-comment-id:4097609840 --> @fatedier commented on GitHub (Mar 20, 2026): Fixed in v0.68.0.
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: github-starred/frp#4068
No description provided.