Why is Jenkins throwing Bad Message 413?

Article ID:360025768511
1 minute readKnowledge base

Issue

When you try to access the instance, you get a Bad Message 413 (Request Entity Too Large) error. This is a known Jenkins issue JENKINS-25046, specifically when using Jetty as the web server. As each time that Jenkins restarts its session cookie changes. The problem is that after some time, your browser can have a bunch of session cookies each one with a different name. This causes the cookie request header to be very long, this will cause the server to return a 413 response and a blank page.

Resolution

In Jenkins versions higher than 2.66, you will have a Jetty version included that will allow you to customize the above described behavior via the following System properties:

  • executableWar.jetty.disableCustomSessionIdCookieName the default value for this property is false. You could set this to true to prevent the problem described above.

  • executableWar.jetty.sessionIdCookieName which defaults to null. But sets a custom session ID cookie name when the previous parameter is set to false.

References

This article is part of our Knowledge Base and is provided for guidance-based purposes only. The solutions or workarounds described here are not officially supported by CloudBees and may not be applicable in all environments. Use at your own discretion, and test changes in a safe environment before applying them to production systems.