Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ntfy behind Traefik proxy, loop causing rate-limit. #334

Closed
oester opened this issue Jun 20, 2022 · 3 comments
Closed

ntfy behind Traefik proxy, loop causing rate-limit. #334

oester opened this issue Jun 20, 2022 · 3 comments
Labels
question This is a question server Relates to the main binary (server or client)

Comments

@oester
Copy link

oester commented Jun 20, 2022

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.

@binwiederhier
Copy link
Owner

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.

@binwiederhier binwiederhier added question This is a question server Relates to the main binary (server or client) labels Jun 20, 2022
@binwiederhier
Copy link
Owner

binwiederhier commented Jun 20, 2022

Done in 30c2a67

@binwiederhier
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question This is a question server Relates to the main binary (server or client)
Projects
None yet
Development

No branches or pull requests

2 participants