Coverage for nova/conf/wsgi.py: 88%

8 statements  

« prev     ^ index     » next       coverage.py v7.6.12, created at 2025-04-17 15:08 +0000

1# Copyright 2015 OpenStack Foundation 

2# All Rights Reserved. 

3# 

4# Licensed under the Apache License, Version 2.0 (the "License"); you may 

5# not use this file except in compliance with the License. You may obtain 

6# a copy of the License at 

7# 

8# http://www.apache.org/licenses/LICENSE-2.0 

9# 

10# Unless required by applicable law or agreed to in writing, software 

11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 

12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 

13# License for the specific language governing permissions and limitations 

14# under the License. 

15 

16from oslo_config import cfg 

17 

18wsgi_group = cfg.OptGroup( 

19 'wsgi', 

20 title='WSGI Options', 

21 help=''' 

22Options under this group are used to configure WSGI (Web Server Gateway 

23Interface). WSGI is used to serve API requests. 

24''', 

25) 

26 

27ALL_OPTS = [ 

28 cfg.StrOpt( 

29 'api_paste_config', 

30 default="api-paste.ini", 

31 deprecated_group='DEFAULT', 

32 help=""" 

33This option represents a file name for the paste.deploy config for nova-api. 

34 

35Possible values: 

36 

37* A string representing file name for the paste.deploy config. 

38"""), 

39 cfg.StrOpt( 

40 'secure_proxy_ssl_header', 

41 deprecated_group='DEFAULT', 

42 deprecated_for_removal=True, 

43 deprecated_since='31.0.0', 

44 deprecated_reason=""" 

45The functionality of this parameter is duplicate of the http_proxy_to_wsgi 

46middleware of oslo.middleware and will be completely replaced. 

47""", 

48 help=""" 

49This option specifies the HTTP header used to determine the protocol scheme 

50for the original request, even if it was removed by a SSL terminating proxy. 

51 

52Possible values: 

53 

54* None (default) - the request scheme is not influenced by any HTTP headers 

55* Valid HTTP header, like ``HTTP_X_FORWARDED_PROTO`` 

56 

57WARNING: Do not set this unless you know what you are doing. 

58 

59Make sure ALL of the following are true before setting this (assuming the 

60values from the example above): 

61 

62* Your API is behind a proxy. 

63* Your proxy strips the X-Forwarded-Proto header from all incoming requests. 

64 In other words, if end users include that header in their requests, the proxy 

65 will discard it. 

66* Your proxy sets the X-Forwarded-Proto header and sends it to API, but only 

67 for requests that originally come in via HTTPS. 

68 

69If any of those are not true, you should keep this setting set to None. 

70"""), 

71] 

72 

73 

74def register_opts(conf): 

75 conf.register_group(wsgi_group) 

76 conf.register_opts(ALL_OPTS, group=wsgi_group) 

77 

78 

79def list_opts(): 

80 return {wsgi_group: ALL_OPTS}