Increase request line limit to 8190 bytes - #75
Conversation
Increase the limit for request lines to accommodate larger Clay watchface configs saved as JSON.
|
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. |
|
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. |
Problem
Saving a large Clay watchface configuration fails with:
Root cause
The
webservice is started viadocker_start.shwith:cloudpebble/gunicorn.pydid not setlimit_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 = 8190incloudpebble/gunicorn.pyto allow larger request lines/headers, so bigger Clay configs saved as JSON no longer get rejected.