Merge "VNC harcoded server name removed"
This commit is contained in:
commit
1dbff8a530
@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
New string configuration option ``vnc_server_header`` is added
|
||||||
|
to ``compute-feature-enabled`` section. It offers to provide VNC server
|
||||||
|
name that is to be expected in the responce header. For example, obvious
|
||||||
|
at hand names is 'WebSockify', 'nginx'.
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
Fix VNC server response header issue when it is behind reverse proxy
|
@ -151,11 +151,22 @@ class NoVNCConsoleTestJSON(base.BaseV2ComputeTest):
|
|||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
self._websocket.response.startswith(b'HTTP/1.1 101 Switching '
|
self._websocket.response.startswith(b'HTTP/1.1 101 Switching '
|
||||||
b'Protocols\r\n'),
|
b'Protocols\r\n'),
|
||||||
'Did not get the expected 101 on the websockify call: '
|
'Did not get the expected 101 on the {} call: {}'.format(
|
||||||
+ six.text_type(self._websocket.response))
|
CONF.compute_feature_enabled.vnc_server_header,
|
||||||
self.assertTrue(
|
six.text_type(self._websocket.response)
|
||||||
self._websocket.response.find(b'Server: WebSockify') > 0,
|
)
|
||||||
'Did not get the expected WebSocket HTTP Response.')
|
)
|
||||||
|
# Since every other server type returns Headers with different case
|
||||||
|
# (for example 'nginx'), lowercase must be applied to eliminate issues.
|
||||||
|
_desired_header = "server: {0}".format(
|
||||||
|
CONF.compute_feature_enabled.vnc_server_header
|
||||||
|
).lower()
|
||||||
|
_response = six.text_type(self._websocket.response).lower()
|
||||||
|
self.assertIn(
|
||||||
|
_desired_header,
|
||||||
|
_response,
|
||||||
|
'Did not get the expected WebSocket HTTP Response.'
|
||||||
|
)
|
||||||
|
|
||||||
@decorators.idempotent_id('c640fdff-8ab4-45a4-a5d8-7e6146cbd0dc')
|
@decorators.idempotent_id('c640fdff-8ab4-45a4-a5d8-7e6146cbd0dc')
|
||||||
def test_novnc(self):
|
def test_novnc(self):
|
||||||
|
@ -407,6 +407,10 @@ ComputeFeaturesGroup = [
|
|||||||
default=False,
|
default=False,
|
||||||
help='Enable VNC console. This configuration value should '
|
help='Enable VNC console. This configuration value should '
|
||||||
'be same as [nova.vnc]->vnc_enabled in nova.conf'),
|
'be same as [nova.vnc]->vnc_enabled in nova.conf'),
|
||||||
|
cfg.StrOpt('vnc_server_header',
|
||||||
|
default='WebSockify',
|
||||||
|
help='Expected VNC server name (WebSockify, nginx, etc) '
|
||||||
|
'in response header.'),
|
||||||
cfg.BoolOpt('spice_console',
|
cfg.BoolOpt('spice_console',
|
||||||
default=False,
|
default=False,
|
||||||
help='Enable Spice console. This configuration value should '
|
help='Enable Spice console. This configuration value should '
|
||||||
|
Loading…
Reference in New Issue
Block a user