Hello everyone,
I have a simple Python web app deployed on App Platform. Occasionally, the app receives requests with very long headers, which leads to a 400 Bad Request error with the description “Request Header or Cookie Too Large” from App Platform via Cloudflare-Nginx.
From what I understand, adjusting some Nginx settings might resolve this issue, though I’m not an expert in this area. However, since these settings are preconfigured at a higher level on App Platform, I don’t have direct access to modify them. Any suggestions on how I might work around this?
Thanks in advance for your help!
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hey Daniele,
The error
Request Header or Cookie Too Large
seems to be actually coming from Cloudflare, not directly from your application or Nginx itself. AS the App Platform uses Cloudflare for traffic routing, you won’t have direct access to adjust the Nginx configuration or Cloudflare settings on App Platform.One option here is for you to review the headers or cookies being sent to your app. Maybe there’s some unnecessary data being transmitted that can be safely trimmed or minimized?
For example, if you have a particularly large cookie or header, you should consider storing the data on the server side and only sending an identifier in the request.
If trimming headers and cookies doesn’t resolve the issue, or if you need more flexibility, you can consider moving your app to a Droplet instead.
By deploying your app on a Droplet, you get root access to the server, and this will be allowing you to tweak Nginx settings to increase the allowed header size to match your exact needs:
Let me know how it goes! Trimming down headers is always a good first step, but if you find yourself needing more control, Droplets can offer the flexibility you’re looking for.
- Bobby