Question

Request Header Or Cookie Too Large on App Platform

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!


Submit an answer


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!

Sign In or Sign Up to Answer

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.

Bobby Iliev
Site Moderator
Site Moderator badge
November 13, 2024

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:

https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-20-04

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

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.