diff --git a/oslo_service/_options.py b/oslo_service/_options.py index 0b356d21..72c06f36 100644 --- a/oslo_service/_options.py +++ b/oslo_service/_options.py @@ -88,6 +88,11 @@ wsgi_opts = [ "If an incoming connection is idle for this number of " "seconds it will be closed. A value of '0' means " "wait forever."), + cfg.BoolOpt('wsgi_server_debug', + default=False, + help="True if the server should send exception tracebacks to " + "the clients on 500 errors. If False, the server will " + "respond with empty bodies."), ] ssl_opts = [ diff --git a/oslo_service/wsgi.py b/oslo_service/wsgi.py index 731e2a46..8b518bd2 100644 --- a/oslo_service/wsgi.py +++ b/oslo_service/wsgi.py @@ -180,7 +180,7 @@ class Server(service.ServiceBase): 'custom_pool': self._pool, 'log': self._logger, 'log_format': self.conf.wsgi_log_format, - 'debug': False, + 'debug': self.conf.wsgi_server_debug, 'keepalive': self.conf.wsgi_keep_alive, 'socket_timeout': self.client_socket_timeout } diff --git a/releasenotes/notes/add-wsgi_server_debug-opt-70d818b5b78bfc7c.yaml b/releasenotes/notes/add-wsgi_server_debug-opt-70d818b5b78bfc7c.yaml new file mode 100644 index 00000000..b9a952cd --- /dev/null +++ b/releasenotes/notes/add-wsgi_server_debug-opt-70d818b5b78bfc7c.yaml @@ -0,0 +1,7 @@ +--- +features: + - | + A new config options, ``[DEFAULT] wsgi_server_debug``, has been added. + This allows admins to configure whether the server should send exception + tracebacks to the clients on HTTP 500 errors. This defaults to ``False``, + preserving previous behavior.