Skip to content

Increase request line limit to 8190 bytes - #75

Open
ProggroP wants to merge 1 commit into
coredevices:mainfrom
ProggroP:ProggroP-patch-1
Open

Increase request line limit to 8190 bytes#75
ProggroP wants to merge 1 commit into
coredevices:mainfrom
ProggroP:ProggroP-patch-1

Conversation

@ProggroP

Copy link
Copy Markdown

Problem

Saving a large Clay watchface configuration fails with:

Bad Request
Request Line is too large (4374 > 4094)

Root cause

The web service is started via docker_start.sh with:

gunicorn -c gunicorn.py cloudpebble.wsgi --bind 0.0.0.0:$PORT

cloudpebble/gunicorn.py did not set limit_request_line, so Gunicorn fell back to its default of exactly 4094 bytes - matching the error message. The nginx configs (nginx/nginx.conf, nginx/nginx.hetzner.conf) don't restrict header/request-line size, so Gunicorn is the limiting factor.

Fix

Explicitly set limit_request_line = 8190 in cloudpebble/gunicorn.py to allow larger request lines/headers, so bigger Clay configs saved as JSON no longer get rejected.

Increase the limit for request lines to accommodate larger Clay watchface configs saved as JSON.
@KiserDesigns

Copy link
Copy Markdown
Contributor

I wonder if this is put in place for parity with the Pebble app on Android/iOS. Does the app's pkjs implementation allow for long request lines?

Quick Google search yielded this: https://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsers. Seems like most modern browsers support 8000-character requests.

@ProggroP

ProggroP commented Aug 7, 2026

Copy link
Copy Markdown
Author

I don't think it's intentional parity. On a real phone the config page closes via the pebblejs://close# custom URL scheme, which the app intercepts locally, so no HTTP request is ever made and there's no request line to limit. The emulator's return_to flow is the only path where the settings actually travel as a real HTTP request, which is where Gunicorn's default kicks in. That also matches what I see in practice: the same config that fails in the emulator saves fine on the watch.

And your browser link actually argues for raising it. If browsers handle ~8000 characters, then 4094 isn't parity with anything, it's well below what the client side already supports. Setting limit_request_line = 8190 would line it up with that.

Caveat: I haven't read the current Android/iOS pkjs implementation myself, so the first part is reasoning from the mechanism rather than from their source.

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

Successfully merging this pull request may close these issues.

2 participants