[PR #1338] [MERGED] Websocket http error codes #1570

Closed
opened 2026-05-07 01:02:43 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/binwiederhier/ntfy/pull/1338
Author: @wunter8
Created: 5/14/2025
Status: Merged
Merged: 5/22/2025
Merged by: @binwiederhier

Base: mainHead: websockets-401


📝 Commits (2)

  • f110472 fix typo
  • cdae549 write http errors to websocket connection instead of always 200

📊 Changes

1 file changed (+5 additions, -4 deletions)

View changed files

📝 server/server.go (+5 -4)

📄 Description

Fixes #1337

I spent a long time working with someone on Discord to figure out why ntfy was returning a 200 code on a websocket request instead of the expected 101.

We finally figured out the issue was that the request wasn't authorized. Turns out, ntfy was swallowing the 403 error and not writing anything to the websocket connection. An empty response was treated as a 200 OK.

Now, ntfy will write the error codes to the websocket connection (but it still will not write any response body). So, if you try accessing a read-restricted topic using websockets now, it will correctly respond with 403 Forbidden instead of 200 OK.


🔄 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/binwiederhier/ntfy/pull/1338 **Author:** [@wunter8](https://github.com/wunter8) **Created:** 5/14/2025 **Status:** ✅ Merged **Merged:** 5/22/2025 **Merged by:** [@binwiederhier](https://github.com/binwiederhier) **Base:** `main` ← **Head:** `websockets-401` --- ### 📝 Commits (2) - [`f110472`](https://github.com/binwiederhier/ntfy/commit/f110472204c9d74a98e9ee8cb2ee35898fbe3dcb) fix typo - [`cdae549`](https://github.com/binwiederhier/ntfy/commit/cdae5493e267f8d3ac8167291f6e3d8d8d95a4bd) write http errors to websocket connection instead of always 200 ### 📊 Changes **1 file changed** (+5 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `server/server.go` (+5 -4) </details> ### 📄 Description Fixes #1337 I spent a long time working with someone on Discord to figure out why ntfy was returning a `200` code on a websocket request instead of the expected `101`. We finally figured out the issue was that the request wasn't authorized. Turns out, ntfy was swallowing the 403 error and not writing anything to the websocket connection. An empty response was treated as a `200 OK`. Now, ntfy will write the error codes to the websocket connection (but it still will not write any response body). So, if you try accessing a read-restricted topic using websockets now, it will correctly respond with `403 Forbidden` instead of `200 OK`. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-07 01:02:43 +02:00
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
starred/ntfy#1570
No description provided.