Skip to main content

AppEngine Header Length Limit

· 3 min read

I rely heavily on Google AppEngine which is a platform-as-a-service (PaaS) offering that I can deploy my apps on without having to worry about the actual server instances powering the application.

Contrast this to infrastructure-as-a-service (IaaS) where I decide on the number of servers to spin up for my application.

The benefit of a PaaS offering is an abstraction of the underlying server stuff (and all the nitty gritty server admin issues).

This is great for the developer because the weight of the server admin hat that you have to wear is made a lot more manageable. The tradeoff for this abstraction is the lock-in that you have to endure as a developer.

I'm not familiar with other PaaS providers - my only experience is with Google AppEngine so I can only speak to that.

On Google AppEngine you are required to write your app using languages that are supported on the platform e.g. Java, Python, etc.

In addition to being restricted to writing your app in specific languages, your data must be stored in formats available in that platform. In the early days of AppEngine this was restricted the Datastore database.

Trading for all these drawbacks is the huge benefit of not having to handle the tiny details of administering servers. For a one-man development team, the value cannot be overstated.

However, being on a specific platform means there are quirks on the platform that you have to deal with.

This is similar to learning a new language - there are always strange quirks that you only encounter after you have worked with it deeply enough.

One example of this is the header length limit imposed by AppEngine. When I was trying to send some data as a HTTP response header, I realised that my client was unable to get the expected data from the response.

I can't remember exactly how I came across this problem but my impression was that this limit was only imposed in the actual deployment but not on the development server.

So after some Googling, I came across this StackOverflow post ( http://stackoverflow.com/questions/15280027/is-there-a-size-limit-for-http-response-headers-on-google-app-engine). So it seems that there is a limit of 497 characters that can be placed in the response header (including the colon and the space after it). Exceeding this limit meant that the header would be dropped.

I thought I would have come across this from Google's documentation but clearly not. To Google's credit, the documentation is thorough but sometimes, certain pieces of information need to be made more obvious so that developers are not caught off guards.