binwiederhier / ntfy

Send push notifications to your phone or desktop using PUT/POST
https://ntfy.sh
Apache License 2.0
18.55k stars 730 forks source link

HTTP 413: JSON body too large #1073

Closed davidfrickert closed 8 months ago

davidfrickert commented 8 months ago

:lady_beetle: Describe the bug It seems that the JSON method to send notifications to ntfy has a body size limit. Did not find any documentation on what this size is and if it's possible to increase.

:computer: Components impacted ntfy server

:bulb: Screenshots and/or logs 2024/03/27 17:22:35 INFO Connection closed with HTTP 413 (ntfy error 41303) (error=JSON body too large, error_code=41303, http_method=POST, http_path=/, http_status=413, tag=http, visitor_auth_limiter_limit=0.016666666666666666, visitor_auth_limiter_tokens=30, visitor_id=ip:10.42.0.229, visitor_ip=10.42.0.229, visitor_messages=14, visitor_messages_limit=17280, visitor_messages_remaining=17266, visitor_request_limiter_limit=0.2, visitor_request_limiter_tokens=60, visitor_seen=2024-03-27T17:22:35.243Z)

:crystal_ball: Additional context Trying to get Grafana to send notifications to ntfy and sometimes Grafana will try to merge multiple related warnings in one notification, which becomes quite big. It seems that ntfy rejects these requests due to the payload size being too big.

wunter8 commented 8 months ago

By default, the message size limit is 4 KiB. If you're sending a JSON body and use the new templating system, the body can be 32 KiB, so long as the resulting message after applying the templating is <= 4 KiB

wunter8 commented 8 months ago

If you're self-hosting, the message size limit is configurable: https://docs.ntfy.sh/config/#message-limits

But see the warning!

davidfrickert commented 8 months ago

@wunter8 thanks! Will test it out as I am indeed self-hosting.