Browse Source

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
tags/2014.1.b2
Florent Flament 5 years ago
parent
commit
df8be62e58
2 changed files with 12 additions and 0 deletions
  1. 6
    0
      etc/glance-api.conf
  2. 6
    0
      glance/common/wsgi.py

+ 6
- 0
etc/glance-api.conf View File

@@ -73,6 +73,12 @@ sql_idle_timeout = 3600
73 73
 # this value to the number of CPUs present on your machine.
74 74
 workers = 1
75 75
 
76
+# Maximum line size of message headers to be accepted.
77
+# max_header_line may need to be increased when using large tokens
78
+# (typically those generated by the Keystone v3 API with big service
79
+# catalogs)
80
+# max_header_line = 16384
81
+
76 82
 # Role used to identify an authenticated user as administrator
77 83
 #admin_role = admin
78 84
 

+ 6
- 0
glance/common/wsgi.py View File

@@ -79,6 +79,11 @@ eventlet_opts = [
79 79
                       'only supported \'poll\', however \'selects\' may be '
80 80
                       'appropriate for some platforms. See '
81 81
                       'http://eventlet.net/doc/hubs.html for more details.')),
82
+    cfg.IntOpt('max_header_line', default=16384,
83
+               help=_('Maximum line size of message headers to be accepted. '
84
+                      'max_header_line may need to be increased when using '
85
+                      'large tokens (typically those generated by the '
86
+                      'Keystone v3 API with big service catalogs')),
82 87
 ]
83 88
 
84 89
 
@@ -177,6 +182,7 @@ class Server(object):
177 182
     """Server class to manage multiple WSGI sockets and applications."""
178 183
 
179 184
     def __init__(self, threads=1000):
185
+        eventlet.wsgi.MAX_HEADER_LINE = CONF.max_header_line
180 186
         self.threads = threads
181 187
         self.children = []
182 188
         self.running = True

Loading…
Cancel
Save