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

Android Firefox returns a "413 Payload Too Large" #23

Closed
JRaspass opened this issue Apr 3, 2019 · 3 comments
Closed

Android Firefox returns a "413 Payload Too Large" #23

JRaspass opened this issue Apr 3, 2019 · 3 comments

Comments

@JRaspass
Copy link

JRaspass commented Apr 3, 2019

Firstly, great work on this library, its working wonderfully for Chrome (Android/Desktop) and Firefox (Desktop), but I'm getting the following error when sending to Firefox on Android:

{"code": 413, "errno": 104, "error": "Payload Too Large", "more_info": "http://autopush.readthedocs.io/en/latest/http.html#error-codes", "message": "This message is intended for a constrained device and is limited to 3070 bytes. Converted buffer too long by 1366 bytes"}
@andrewtet
Copy link

andrewtet commented Apr 3, 2019

@JRaspass running into the same issues and I was actually going to write up an issue about this last night. Seems like the issue is with the maxRecordLength and the pad function. The maxRecordLength in webpush-go is hard coded to 4096 and we pad every message to that length for security reasons, but for Firefox Mobile the max content length is 3070.

There's a PHP library for webpush that had similar issues and allows for a custom max content size to be passed in. @SherClockHolmes would you be okay with that solution?

PHP lib issue: web-push-libs/web-push-php#62

PHP lib documentation of max content sizeL: https://github.com/web-push-libs/web-push-php#how-can-i-disable-or-customize-automatic-padding

P.S. It's been a while, but hope all is well @SherClockHolmes. This lib is great BTW

@SherClockHolmes
Copy link
Owner

SherClockHolmes commented Apr 6, 2019

@JRaspass @andrewtet Thanks for digging into the issue for me. I should have time for implementing this over the weekend.

@ptman
Copy link

ptman commented Dec 7, 2021

For some reason RecordSize: 3070 didn't work for me with firefox android. I got a response back saying: "Final composed message payload too long for recipient: 4170 bytes. Please try a shorter message." No idea why that was larger than the limit set

RecordSize: 2048 seems to have worked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants