From df8be62e58d8eb36cef43a7f3b594ff0a0e1ccb6 Mon Sep 17 00:00:00 2001 From: Florent Flament Date: Mon, 13 Jan 2014 13:43:59 +0000 Subject: [PATCH] Allow users to customize max header size Also increases the default value from 8192 to 16384 The former max header (8192) is exceeded in the following scenario - Auth tokens built with a keystone v3 API catalog - A catalog with approximately 8 or more endpoints defined Equivalent fixes have been proposed in other projects Change-Id: Ic714166440e2aa08b619ab1e5e5e0cf3cea3e309 Closes-Bug: 1190149 --- etc/glance-api.conf | 6 ++++++ glance/common/wsgi.py | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/etc/glance-api.conf b/etc/glance-api.conf index cdee165a3e..3735771de0 100644 --- a/etc/glance-api.conf +++ b/etc/glance-api.conf @@ -73,6 +73,12 @@ sql_idle_timeout = 3600 # this value to the number of CPUs present on your machine. workers = 1 +# Maximum line size of message headers to be accepted. +# max_header_line may need to be increased when using large tokens +# (typically those generated by the Keystone v3 API with big service +# catalogs) +# max_header_line = 16384 + # Role used to identify an authenticated user as administrator #admin_role = admin diff --git a/glance/common/wsgi.py b/glance/common/wsgi.py index 0df6c876ca..e1a492f6d1 100644 --- a/glance/common/wsgi.py +++ b/glance/common/wsgi.py @@ -79,6 +79,11 @@ eventlet_opts = [ 'only supported \'poll\', however \'selects\' may be ' 'appropriate for some platforms. See ' 'http://eventlet.net/doc/hubs.html for more details.')), + cfg.IntOpt('max_header_line', default=16384, + help=_('Maximum line size of message headers to be accepted. ' + 'max_header_line may need to be increased when using ' + 'large tokens (typically those generated by the ' + 'Keystone v3 API with big service catalogs')), ] @@ -177,6 +182,7 @@ class Server(object): """Server class to manage multiple WSGI sockets and applications.""" def __init__(self, threads=1000): + eventlet.wsgi.MAX_HEADER_LINE = CONF.max_header_line self.threads = threads self.children = [] self.running = True