[GH-ISSUE #334] ntfy behind Traefik proxy, loop causing rate-limit. #261

Closed
opened 2026-05-07 00:22:23 +02:00 by BreizhHardware · 3 comments

Originally created by @oester on GitHub (Jun 20, 2022).
Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/334

I have ntfy behind a traefik proxy, and although I can subscribe, messages seem to go into a loop and time out with a rate limit. Here is my server.yml file: (redacted to not show actual domain):

base-url: "https://ntfy.xxx.org"
cache-file: "/var/cache/ntfy/cache.db"
attachment-cache-dir: "/var/cache/ntfy/attachments"
behind-proxy: true
upstream-base-url: "https://ntfy.xxx.org"

If send a message to the "test" topic, I see this in the log:

2022/06/20 00:55:31 INFO Listening on :80[http], ntfy 1.26.0, log level is INFO
2022/06/20 00:56:31 INFO Stats: 32 messages published, 3 in cache, 2 topic(s) active, 0 subscriber(s), 2 visitor(s), 0 mails received (0 successful, 0 failed), 0 mails sent (0 successful, 0 failed)
2022/06/20 00:56:32 INFO 172.70.126.81 HTTP POST /5d1e3888f7ae011705f02959ede7ffc27f2452227ff7b615e310a674496f8383 Connection closed with HTTP 429 (ntfy error 42901): limit reached: too many requests, please be nice
2022/06/20 00:56:33 WARN 172.70.126.81/dc31f59cbecd56c3c3f8d0c76b3502044a8adf9e9db452f1929d571766d681df/NKEMjgaHjpSh Unable to publish poll request, unexpected HTTP status: 429
2022/06/20 00:57:31 INFO Stats: 61 messages published, 3 in cache, 2 topic(s) active, 0 subscriber(s), 2 visitor(s), 0 mails received (0 successful, 0 failed), 0 mails sent (0 successful, 0 failed)

With debug, I see this in the log, with a loop of requests until it finally fails with rate-limit:

2022/06/20 00:55:00 DEBUG 172.70.130.131 HTTP POST /ec2a675d51421c2297ca0223f781fac94805a06c7d230117d74667acd6be552b Dispatching request
2022/06/20 00:55:00 DEBUG 172.70.130.131/ec2a675d51421c2297ca0223f781fac94805a06c7d230117d74667acd6be552b/J2TsTfAOBoZ2 Received message: event=poll_request, body=11 byte(s), delayed=false, firebase=true, cache=false, up=false, email=
2022/06/20 00:55:00 DEBUG 172.70.130.131/ec2a675d51421c2297ca0223f781fac94805a06c7d230117d74667acd6be552b/J2TsTfAOBoZ2 Publishing poll request to https://ntfy.xxx.org/a736402aa3b0e766ed3f3a534d7e56165193f6f5517a052476257df57f196b1c
2022/06/20 00:55:00 DEBUG 172.70.130.131 HTTP POST /a736402aa3b0e766ed3f3a534d7e56165193f6f5517a052476257df57f196b1c Dispatching request
2022/06/20 00:55:00 DEBUG 172.70.130.131/a736402aa3b0e766ed3f3a534d7e56165193f6f5517a052476257df57f196b1c/HHxvaHzd5RKr Received message: event=poll_request, body=11 byte(s), delayed=false, firebase=true, cache=false, up=false, email=
2022/06/20 00:55:00 DEBUG 172.70.130.131/a736402aa3b0e766ed3f3a534d7e56165193f6f5517a052476257df57f196b1c/HHxvaHzd5RKr Publishing poll request to https://ntfy.xxx.org/61eaae2826b7606321c4bfee7cad089134f4cbfc712e779dca3af2c8d0fcd276
2022/06/20 00:55:00 DEBUG 172.70.130.131 HTTP POST /61eaae2826b7606321c4bfee7cad089134f4cbfc712e779dca3af2c8d0fcd276 Dispatching request
2022/06/20 00:55:00 INFO 172.70.130.131 HTTP POST /61eaae2826b7606321c4bfee7cad089134f4cbfc712e779dca3af2c8d0fcd276 Connection closed with HTTP 429 (ntfy error 42901): limit reached: too many requests, please be nice
2022/06/20 00:55:00 WARN 172.70.130.131/a736402aa3b0e766ed3f3a534d7e56165193f6f5517a052476257df57f196b1c/HHxvaHzd5RKr Unable to publish poll request, unexpected HTTP status: 429

It's like the server is sending the request back to itself, endlessly. I can show you the traefik config, but it's pretty basic. Server is in docker with port 80 mapped to 4080 on the outside.

Originally created by @oester on GitHub (Jun 20, 2022). Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/334 I have ntfy behind a traefik proxy, and although I can subscribe, messages seem to go into a loop and time out with a rate limit. Here is my server.yml file: (redacted to not show actual domain): ``` base-url: "https://ntfy.xxx.org" cache-file: "/var/cache/ntfy/cache.db" attachment-cache-dir: "/var/cache/ntfy/attachments" behind-proxy: true upstream-base-url: "https://ntfy.xxx.org" ``` If send a message to the "test" topic, I see this in the log: ``` 2022/06/20 00:55:31 INFO Listening on :80[http], ntfy 1.26.0, log level is INFO 2022/06/20 00:56:31 INFO Stats: 32 messages published, 3 in cache, 2 topic(s) active, 0 subscriber(s), 2 visitor(s), 0 mails received (0 successful, 0 failed), 0 mails sent (0 successful, 0 failed) 2022/06/20 00:56:32 INFO 172.70.126.81 HTTP POST /5d1e3888f7ae011705f02959ede7ffc27f2452227ff7b615e310a674496f8383 Connection closed with HTTP 429 (ntfy error 42901): limit reached: too many requests, please be nice 2022/06/20 00:56:33 WARN 172.70.126.81/dc31f59cbecd56c3c3f8d0c76b3502044a8adf9e9db452f1929d571766d681df/NKEMjgaHjpSh Unable to publish poll request, unexpected HTTP status: 429 2022/06/20 00:57:31 INFO Stats: 61 messages published, 3 in cache, 2 topic(s) active, 0 subscriber(s), 2 visitor(s), 0 mails received (0 successful, 0 failed), 0 mails sent (0 successful, 0 failed) ``` With debug, I see this in the log, with a loop of requests until it finally fails with rate-limit: ``` 2022/06/20 00:55:00 DEBUG 172.70.130.131 HTTP POST /ec2a675d51421c2297ca0223f781fac94805a06c7d230117d74667acd6be552b Dispatching request 2022/06/20 00:55:00 DEBUG 172.70.130.131/ec2a675d51421c2297ca0223f781fac94805a06c7d230117d74667acd6be552b/J2TsTfAOBoZ2 Received message: event=poll_request, body=11 byte(s), delayed=false, firebase=true, cache=false, up=false, email= 2022/06/20 00:55:00 DEBUG 172.70.130.131/ec2a675d51421c2297ca0223f781fac94805a06c7d230117d74667acd6be552b/J2TsTfAOBoZ2 Publishing poll request to https://ntfy.xxx.org/a736402aa3b0e766ed3f3a534d7e56165193f6f5517a052476257df57f196b1c 2022/06/20 00:55:00 DEBUG 172.70.130.131 HTTP POST /a736402aa3b0e766ed3f3a534d7e56165193f6f5517a052476257df57f196b1c Dispatching request 2022/06/20 00:55:00 DEBUG 172.70.130.131/a736402aa3b0e766ed3f3a534d7e56165193f6f5517a052476257df57f196b1c/HHxvaHzd5RKr Received message: event=poll_request, body=11 byte(s), delayed=false, firebase=true, cache=false, up=false, email= 2022/06/20 00:55:00 DEBUG 172.70.130.131/a736402aa3b0e766ed3f3a534d7e56165193f6f5517a052476257df57f196b1c/HHxvaHzd5RKr Publishing poll request to https://ntfy.xxx.org/61eaae2826b7606321c4bfee7cad089134f4cbfc712e779dca3af2c8d0fcd276 2022/06/20 00:55:00 DEBUG 172.70.130.131 HTTP POST /61eaae2826b7606321c4bfee7cad089134f4cbfc712e779dca3af2c8d0fcd276 Dispatching request 2022/06/20 00:55:00 INFO 172.70.130.131 HTTP POST /61eaae2826b7606321c4bfee7cad089134f4cbfc712e779dca3af2c8d0fcd276 Connection closed with HTTP 429 (ntfy error 42901): limit reached: too many requests, please be nice 2022/06/20 00:55:00 WARN 172.70.130.131/a736402aa3b0e766ed3f3a534d7e56165193f6f5517a052476257df57f196b1c/HHxvaHzd5RKr Unable to publish poll request, unexpected HTTP status: 429 ``` It's like the server is sending the request back to itself, endlessly. I can show you the traefik config, but it's pretty basic. Server is in docker with port 80 mapped to 4080 on the outside.
BreizhHardware 2026-05-07 00:22:23 +02:00
Author
Owner

@binwiederhier commented on GitHub (Jun 20, 2022):

upstream-base-url needs to be https://ntfy.sh, not your own domain URL. I'm sorry this is so complicated and weird, but there's a description of the flow here: https://ntfy.sh/docs/config/#ios-instant-notifications

I'll make sure that you can never set upstream-base-url to the same value as base-url so this cannot happen.

<!-- gh-comment-id:1159870053 --> @binwiederhier commented on GitHub (Jun 20, 2022): `upstream-base-url` needs to be `https://ntfy.sh`, not your own domain URL. I'm sorry this is so complicated and weird, but there's a description of the flow here: https://ntfy.sh/docs/config/#ios-instant-notifications I'll make sure that you can never set `upstream-base-url` to the same value as `base-url` so this cannot happen.
Author
Owner

@binwiederhier commented on GitHub (Jun 20, 2022):

Done in github.com/binwiederhier/ntfy@30c2a67869

<!-- gh-comment-id:1159872169 --> @binwiederhier commented on GitHub (Jun 20, 2022): Done in https://github.com/binwiederhier/ntfy/commit/30c2a678698908a8c26a474d9d47731f37ed83e9
Author
Owner

@binwiederhier commented on GitHub (Jun 23, 2022):

I'm assuming your original issue is fixed. I'm closing this ticket. Feel free to re-open if it doesn't work

<!-- gh-comment-id:1163793375 --> @binwiederhier commented on GitHub (Jun 23, 2022): I'm assuming your original issue is fixed. I'm closing this ticket. Feel free to re-open if it doesn't work
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#261
No description provided.