Commit 1593304e authored by Łukasz Nowak's avatar Łukasz Nowak

caddy-frontend: Support query string of the backend url

parent bb56f2d7
...@@ -19,6 +19,7 @@ Here are listed the most important changes, which might affect upgrades. ...@@ -19,6 +19,7 @@ Here are listed the most important changes, which might affect upgrades.
* feature: dropped not used parameters * feature: dropped not used parameters
* feature: Strict-Transport-Security aka HSTS * feature: Strict-Transport-Security aka HSTS
* fix: use kedifa with with for file with multiple CAs * fix: use kedifa with with for file with multiple CAs
* feature: support query string (the characters after ? in the url) in url and https-url
1.0.164 (2020-09-24) 1.0.164 (2020-09-24)
-------------------- --------------------
......
...@@ -30,7 +30,7 @@ md5sum = 7cb8157d2b368ab3b281ea42f743eb9c ...@@ -30,7 +30,7 @@ md5sum = 7cb8157d2b368ab3b281ea42f743eb9c
[profile-slave-list] [profile-slave-list]
_update_hash_filename_ = templates/apache-custom-slave-list.cfg.in _update_hash_filename_ = templates/apache-custom-slave-list.cfg.in
md5sum = 772c04c165fdae91299fd909e061f926 md5sum = 5f2c1f3f8eebc8f3453c223b30459722
[profile-replicate-publish-slave-information] [profile-replicate-publish-slave-information]
_update_hash_filename_ = templates/replicate-publish-slave-information.cfg.in _update_hash_filename_ = templates/replicate-publish-slave-information.cfg.in
...@@ -50,7 +50,7 @@ md5sum = a0ae858a3db8825c22d33d323392f588 ...@@ -50,7 +50,7 @@ md5sum = a0ae858a3db8825c22d33d323392f588
[template-backend-haproxy-configuration] [template-backend-haproxy-configuration]
_update_hash_filename_ = templates/backend-haproxy.cfg.in _update_hash_filename_ = templates/backend-haproxy.cfg.in
md5sum = 0923a9227c131d2f1e11d7ddd5b15673 md5sum = d86ae2fcf89deaa08d791da12d5897e4
[template-empty] [template-empty]
_update_hash_filename_ = templates/empty.in _update_hash_filename_ = templates/empty.in
......
...@@ -54,7 +54,7 @@ context = ...@@ -54,7 +54,7 @@ context =
{#- * stabilise values for backend #} {#- * stabilise values for backend #}
{%- for key, prefix in [('url', 'http_backend'), ('https-url', 'https_backend')] %} {%- for key, prefix in [('url', 'http_backend'), ('https-url', 'https_backend')] %}
{%- set parsed = urlparse_module.urlparse(slave_instance.get(key, '').strip()) %} {%- set parsed = urlparse_module.urlparse(slave_instance.get(key, '').strip()) %}
{%- set info_dict = {'scheme': parsed.scheme, 'hostname': parsed.hostname, 'port': parsed.port or DEFAULT_PORT[parsed.scheme], 'path': parsed.path, 'fragment': parsed.fragment} %} {%- set info_dict = {'scheme': parsed.scheme, 'hostname': parsed.hostname, 'port': parsed.port or DEFAULT_PORT[parsed.scheme], 'path': parsed.path, 'fragment': parsed.fragment, 'query': parsed.query} %}
{%- do slave_instance.__setitem__(prefix, info_dict) %} {%- do slave_instance.__setitem__(prefix, info_dict) %}
{%- endfor %} {%- endfor %}
{%- do slave_instance.__setitem__('ssl_proxy_verify', ('' ~ slave_instance.get('ssl-proxy-verify', '')).lower() in TRUE_VALUES) %} {%- do slave_instance.__setitem__('ssl_proxy_verify', ('' ~ slave_instance.get('ssl-proxy-verify', '')).lower() in TRUE_VALUES) %}
......
...@@ -92,7 +92,12 @@ frontend https-backend ...@@ -92,7 +92,12 @@ frontend https-backend
backend {{ slave_instance['slave_reference'] }}-{{ scheme }} backend {{ slave_instance['slave_reference'] }}-{{ scheme }}
{%- set hostname = info_dict['hostname'] %} {%- set hostname = info_dict['hostname'] %}
{%- set port = info_dict['port'] %} {%- set port = info_dict['port'] %}
{%- set path = info_dict['path'].rstrip('/') %} {%- set path_list = [info_dict['path'].rstrip('/')] %}
{%- set query = info_dict['query'] %}
{%- if query %}
{%- do path_list.append(query) %}
{%- endif %}
{%- set path = '?'.join(path_list) %}
{%- if hostname and port %} {%- if hostname and port %}
timeout server {{ slave_instance['request-timeout'] }}s timeout server {{ slave_instance['request-timeout'] }}s
timeout connect {{ slave_instance['backend-connect-timeout'] }}s timeout connect {{ slave_instance['backend-connect-timeout'] }}s
......
...@@ -1278,7 +1278,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin): ...@@ -1278,7 +1278,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
'Url': { 'Url': {
# make URL "incorrect", with whitespace, nevertheless it shall be # make URL "incorrect", with whitespace, nevertheless it shall be
# correctly handled # correctly handled
'url': ' ' + cls.backend_url + ' ', 'url': ' ' + cls.backend_url + '/?a=b&c=' + ' ',
# authenticating to http backend shall be no-op # authenticating to http backend shall be no-op
'authenticate-to-backend': True, 'authenticate-to-backend': True,
}, },
...@@ -1683,8 +1683,8 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin): ...@@ -1683,8 +1683,8 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
}, },
'warning-slave-dict': { 'warning-slave-dict': {
'_Url': [ '_Url': [
"slave url ' %(backend)s ' has been converted to '%(backend)s'" % { "slave url ' %(backend)s/?a=b&c= ' has been converted to "
'backend': self.backend_url}]} "'%(backend)s/?a=b&c='" % {'backend': self.backend_url}]}
} }
self.assertEqual( self.assertEqual(
...@@ -1833,7 +1833,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin): ...@@ -1833,7 +1833,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
'secure_access': 'https://%s.example.com' % (hostname, ), 'secure_access': 'https://%s.example.com' % (hostname, ),
'backend-client-caucase-url': 'http://[%s]:8990' % self._ipv6_address, 'backend-client-caucase-url': 'http://[%s]:8990' % self._ipv6_address,
'warning-list': [ 'warning-list': [
"slave url ' %s ' has been converted to '%s'" % ( "slave url ' %s/?a=b&c= ' has been converted to '%s/?a=b&c='" % (
self.backend_url, self.backend_url)], self.backend_url, self.backend_url)],
}, },
parameter_dict parameter_dict
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment