Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ekaterina
slapos
Commits
1621f01b
Commit
1621f01b
authored
Jul 09, 2020
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
caddy-frontend: Support correctly redirect with custom_domain
parent
3be5f4ce
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
52 additions
and
4 deletions
+52
-4
software/caddy-frontend/buildout.hash.cfg
software/caddy-frontend/buildout.hash.cfg
+1
-1
software/caddy-frontend/templates/apache-custom-slave-list.cfg.in
.../caddy-frontend/templates/apache-custom-slave-list.cfg.in
+3
-1
software/caddy-frontend/test/test.py
software/caddy-frontend/test/test.py
+44
-2
software/caddy-frontend/test/test_data/test.TestSlave.test_file_list_log-CADDY.txt
...est/test_data/test.TestSlave.test_file_list_log-CADDY.txt
+2
-0
software/caddy-frontend/test/test_data/test.TestSlaveGlobalDisableHttp2.test_file_list_log-CADDY.txt
....TestSlaveGlobalDisableHttp2.test_file_list_log-CADDY.txt
+2
-0
No files found.
software/caddy-frontend/buildout.hash.cfg
View file @
1621f01b
...
...
@@ -30,7 +30,7 @@ md5sum = 5dabdbf51d20bf9e9e277e5b84d58b7e
[template-slave-list]
_update_hash_filename_ = templates/apache-custom-slave-list.cfg.in
md5sum =
be95a8ff3b0c2db22d80aa07c47504e3
md5sum =
6349bf609716ef77a1c0af0ad6cdc312
[template-replicate-publish-slave-information]
_update_hash_filename_ = templates/replicate-publish-slave-information.cfg.in
...
...
software/caddy-frontend/templates/apache-custom-slave-list.cfg.in
View file @
1621f01b
...
...
@@ -278,7 +278,9 @@ recipe = slapos.cookbook:publish
{%- else %}
{%- do slave_instance_information_list.append(slave_publish_dict) %}
{%- endif %}
{%- do backend_slave_list.append(slave_instance) %}
{%- if slave_type != 'redirect' %}
{%- do backend_slave_list.append(slave_instance) %}
{%- endif %}
{%- endfor %} {# Slave iteration ends for slave_instance in slave_instance_list #}
[slave-log-directories]
...
...
software/caddy-frontend/test/test.py
View file @
1621f01b
...
...
@@ -1310,6 +1310,11 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
'url'
:
cls
.
backend_url
,
'type'
:
'redirect'
,
},
'type-redirect-custom_domain'
:
{
'url'
:
cls
.
backend_url
,
'type'
:
'redirect'
,
'custom_domain'
:
'customdomaintyperedirect.example.com'
,
},
'enable_cache'
:
{
'url'
:
cls
.
backend_url
,
'enable_cache'
:
True
,
...
...
@@ -1554,9 +1559,9 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
'monitor-base-url'
:
'https://[%s]:8401'
%
self
.
_ipv6_address
,
'backend-client-caucase-url'
:
'http://[%s]:8990'
%
self
.
_ipv6_address
,
'domain'
:
'example.com'
,
'accepted-slave-amount'
:
'5
5
'
,
'accepted-slave-amount'
:
'5
6
'
,
'rejected-slave-amount'
:
'0'
,
'slave-amount'
:
'5
5
'
,
'slave-amount'
:
'5
6
'
,
'rejected-slave-dict'
:
{
}
}
...
...
@@ -3152,6 +3157,43 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
result
.
headers
[
'Location'
]
)
def
test_type_redirect_custom_domain
(
self
):
reference
=
'type-redirect-custom_domain'
hostname
=
'customdomaintyperedirect'
parameter_dict
=
self
.
parseSlaveParameterDict
(
reference
)
self
.
assertLogAccessUrlWithPop
(
parameter_dict
)
self
.
assertKedifaKeysWithPop
(
parameter_dict
,
''
)
self
.
assertEqual
(
{
'domain'
:
'%s.example.com'
%
(
hostname
,),
'replication_number'
:
'1'
,
'url'
:
'http://%s.example.com'
%
(
hostname
,
),
'site_url'
:
'http://%s.example.com'
%
(
hostname
,
),
'secure_access'
:
'https://%s.example.com'
%
(
hostname
,
),
'public-ipv4'
:
self
.
_ipv4_address
,
'backend-client-caucase-url'
:
'http://[%s]:8990'
%
self
.
_ipv6_address
,
},
parameter_dict
)
result
=
fakeHTTPSResult
(
parameter_dict
[
'domain'
],
parameter_dict
[
'public-ipv4'
],
'test-path/deep/.././deeper'
)
self
.
assertEqual
(
self
.
certificate_pem
,
der2pem
(
result
.
peercert
))
self
.
assertEqual
(
httplib
.
FOUND
,
result
.
status_code
)
self
.
assertEqual
(
'%stest-path/deeper'
%
(
self
.
backend_url
,),
result
.
headers
[
'Location'
]
)
def
test_ssl_proxy_verify_ssl_proxy_ca_crt_unverified
(
self
):
parameter_dict
=
self
.
parseSlaveParameterDict
(
'ssl-proxy-verify_ssl_proxy_ca_crt-unverified'
)
...
...
software/caddy-frontend/test/test_data/test.TestSlave.test_file_list_log-CADDY.txt
View file @
1621f01b
...
...
@@ -87,6 +87,8 @@ T-2/var/log/httpd/_ssl_ca_crt_only_access_log
T-2/var/log/httpd/_ssl_ca_crt_only_error_log
T-2/var/log/httpd/_type-notebook_access_log
T-2/var/log/httpd/_type-notebook_error_log
T-2/var/log/httpd/_type-redirect-custom_domain_access_log
T-2/var/log/httpd/_type-redirect-custom_domain_error_log
T-2/var/log/httpd/_type-redirect_access_log
T-2/var/log/httpd/_type-redirect_error_log
T-2/var/log/httpd/_type-websocket-websocket-path-list-websocket-transparent-false_access_log
...
...
software/caddy-frontend/test/test_data/test.TestSlaveGlobalDisableHttp2.test_file_list_log-CADDY.txt
View file @
1621f01b
...
...
@@ -87,6 +87,8 @@ T-2/var/log/httpd/_ssl_ca_crt_only_access_log
T-2/var/log/httpd/_ssl_ca_crt_only_error_log
T-2/var/log/httpd/_type-notebook_access_log
T-2/var/log/httpd/_type-notebook_error_log
T-2/var/log/httpd/_type-redirect-custom_domain_access_log
T-2/var/log/httpd/_type-redirect-custom_domain_error_log
T-2/var/log/httpd/_type-redirect_access_log
T-2/var/log/httpd/_type-redirect_error_log
T-2/var/log/httpd/_type-websocket-websocket-path-list-websocket-transparent-false_access_log
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment