Commit 7bf76c97 authored by Łukasz Nowak's avatar Łukasz Nowak

caddy-frontend: Fix support of url and https-url for type:redirect

The most complex case - no automatic https redirection and usage
of url and https-url is used to check implementation of type:redirect now.
parent 0cf9830b
......@@ -30,7 +30,7 @@ md5sum = e7209d9c66fd30e1fa950d2d07957b95
[profile-slave-list]
_update_hash_filename_ = templates/apache-custom-slave-list.cfg.in
md5sum = 421e2de58c0d5c41a00cd5d32355fc70
md5sum = af8caafa72fe821b220b03e92c00fade
[profile-replicate-publish-slave-information]
_update_hash_filename_ = templates/replicate-publish-slave-information.cfg.in
......
......@@ -102,7 +102,7 @@ context =
{%- if slave_type == 'redirect' %}
{%- do slave_instance.__setitem__('backend-http-url', slave_instance.get('url', '').rstrip('/')) %}
{%- if slave_instance.get('https-url') %}
{%- do slave_instance.__setitem__('backend-https-url', slave_instance.get['https-url'].rstrip('/')) %}
{%- do slave_instance.__setitem__('backend-https-url', slave_instance.get('https-url', '').rstrip('/')) %}
{%- endif %}
{%- elif enable_cache %}
{%- if 'domain' in slave_instance %}
......
......@@ -1797,7 +1797,9 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
},
'type-redirect': {
'url': cls.backend_url,
'https-url': cls.backend_https_url,
'type': 'redirect',
'https-only': False,
},
'type-redirect-custom_domain': {
'url': cls.backend_url,
......@@ -3473,6 +3475,20 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
result.status_code
)
self.assertEqual(
'%stest-path/deeper' % (self.backend_https_url,),
result.headers['Location']
)
result = fakeHTTPResult(
parameter_dict['domain'],
'test-path/deep/.././deeper')
self.assertEqual(
http.client.FOUND,
result.status_code
)
self.assertEqual(
'%stest-path/deeper' % (self.backend_url,),
result.headers['Location']
......
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