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
Léo-Paul Géneau
slapos
Commits
0b81971c
Commit
0b81971c
authored
Aug 31, 2022
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rapid-cdn: c->h: Implement type:redirect
parent
462f5262
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
29 deletions
+37
-29
software/rapid-cdn/buildout.hash.cfg
software/rapid-cdn/buildout.hash.cfg
+1
-1
software/rapid-cdn/templates/default-virtualhost.conf.in
software/rapid-cdn/templates/default-virtualhost.conf.in
+0
-7
software/rapid-cdn/templates/frontend-haproxy.cfg.in
software/rapid-cdn/templates/frontend-haproxy.cfg.in
+25
-21
software/rapid-cdn/test/test.py
software/rapid-cdn/test/test.py
+11
-0
No files found.
software/rapid-cdn/buildout.hash.cfg
View file @
0b81971c
...
...
@@ -38,7 +38,7 @@ md5sum = cba4d995962f7fbeae3f61c9372c4181
[template-frontend-haproxy-configuration]
_update_hash_filename_ = templates/frontend-haproxy.cfg.in
md5sum =
b1cd67d96cce91b5173ce09a9fdc2ac8
md5sum =
3c4ddc00f6dc609ec830648d1f394b81
[template-frontend-haproxy-crt-list]
_update_hash_filename_ = templates/frontend-haproxy-crt-list.in
...
...
software/rapid-cdn/templates/default-virtualhost.conf.in
View file @
0b81971c
...
...
@@ -123,13 +123,6 @@
{%- endif %}
} {# rewrite #}
{%- endif %} {#- if slave_parameter['prefer-gzip-encoding-to-backend'] #}
{%- elif slave_parameter['type'] == 'redirect' %}
{%- if backend_url %}
# Redirect configuration
redir 302 {
/ {{ backend_url }}{rewrite_uri}
}
{%- endif %}
{%- elif slave_parameter['type'] == 'notebook' %}
proxy / {{ backend_url }} {
{{ proxy_header() }}
...
...
software/rapid-cdn/templates/frontend-haproxy.cfg.in
View file @
0b81971c
...
...
@@ -93,37 +93,41 @@ backend {{ slave_instance['slave_reference'] }}-{{ scheme }}
redirect scheme https code 302
{%- else %}
{%- if 'hostname' in info_dict and 'port' in info_dict %}
{%- if slave_instance['type'] == 'redirect' %}
redirect prefix {{ info_dict['scheme'] }}://{{ info_dict['hostname'] }}:{{ info_dict['port'] }} code 302
{%- else %}
server {{ slave_instance['slave_reference'] }}-backend-{{ scheme }} {{ info_dict['hostname'] }}:{{ info_dict['port'] }}
{%- if slave_instance['disable-via-header'] %}
{%-
if slave_instance['disable-via-header'] %}
http-response del-header Via
{%- else %}
{%-
else %}
http-response add-header Via "%HV rapid-cdn-frontend-{{ configuration['node-id'] }}-{{ configuration['version-hash'] }}"
{%- endif %}
{%- if scheme == 'https' %}
{%- if slave_instance['strict-transport-security'] > 0 %}
{%- set strict_transport_security = ['max-age=%i' % (slave_instance['strict-transport-security'],)] %}
{%- if slave_instance['strict-transport-security-sub-domains'] %}
{%- do strict_transport_security.append('; includeSubDomains') %}
{%- endif %}
{%- if slave_instance['strict-transport-security-preload'] %}
{%- do strict_transport_security.append('; preload') %}
{%- endif %}
{%-
endif %}
{%-
if scheme == 'https' %}
{%-
if slave_instance['strict-transport-security'] > 0 %}
{%-
set strict_transport_security = ['max-age=%i' % (slave_instance['strict-transport-security'],)] %}
{%-
if slave_instance['strict-transport-security-sub-domains'] %}
{%-
do strict_transport_security.append('; includeSubDomains') %}
{%-
endif %}
{%-
if slave_instance['strict-transport-security-preload'] %}
{%-
do strict_transport_security.append('; preload') %}
{%-
endif %}
http-response set-header Strict-Transport-Security "{{ ''.join(strict_transport_security) }}"
{%- endif %}
{%- endif %}
{%- endif %}
{%- for disabled_cookie in slave_instance['disabled-cookie-list'] %}
{%- for disabled_cookie in slave_instance['disabled-cookie-list'] %}
http-request replace-header Cookie (.*)(^{{ disabled_cookie | replace('%', '%%') }}=[^;]*;\ |;\ {{ disabled_cookie }}=[^;]*|^{{ disabled_cookie }}=[^;]*$)(.*) \1\3
{%- endfor %}
{%- if slave_instance['disable-no-cache-request'] %}
{%-
endfor %}
{%-
if slave_instance['disable-no-cache-request'] %}
http-request del-header Cache-Control
http-request del-header Pragma
{%- endif %}
{%- if slave_instance['prefer-gzip-encoding-to-backend'] %}
{%-
endif %}
{%-
if slave_instance['prefer-gzip-encoding-to-backend'] %}
http-request set-header Accept-Encoding gzip if { hdr(Accept-Encoding) -m sub gzip }
{%- endif %}
{%- if info_dict['path'] %}
{%-
endif %}
{%-
if info_dict['path'] %}
http-request set-path {{ info_dict['path'] }}%[path]
{%- endif %} {# if info_dict['path'] #}
{%- endif %} {# if info_dict['path'] #}
{%- endif %} {# if slave_instance['type'] == 'redirect' #}
{%- endif %} {# if 'hostname' in info_dict and 'port' in info_dict #}
{%- endif %} {# if scheme == 'http' and slave_instance['https-only'] #}
{%- endfor %} {# for (scheme, prefix) in SCHEME_PREFIX_MAPPING.items() #}
...
...
software/rapid-cdn/test/test.py
View file @
0b81971c
...
...
@@ -2391,6 +2391,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
headers = self.assertResponseHeaders(
result_http, via=False, backend_reached=False)
self.assertEqual(
'
https
:
//
url
.
example
.
com
:
%
s
/
test
-
path
/
deeper
' % (HTTP_PORT,),
headers['
Location
']
...
...
@@ -3530,6 +3531,9 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
result
.
headers
[
'Location'
]
)
headers
=
self
.
assertResponseHeaders
(
result
,
via
=
False
,
backend_reached
=
False
)
result
=
fakeHTTPResult
(
parameter_dict
[
'domain'
],
'test-path/deep/.././deeper'
)
...
...
@@ -3544,6 +3548,9 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
result
.
headers
[
'Location'
]
)
headers
=
self
.
assertResponseHeaders
(
result
,
via
=
False
,
backend_reached
=
False
)
def
test_type_redirect_custom_domain
(
self
):
parameter_dict
=
self
.
assertSlaveBase
(
'type-redirect-custom_domain'
,
hostname
=
'customdomaintyperedirect'
)
...
...
@@ -3566,6 +3573,10 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
result
.
headers
[
'Location'
]
)
headers
=
self
.
assertResponseHeaders
(
result
,
via
=
False
,
backend_reached
=
False
)
def
test_ssl_proxy_verify_ssl_proxy_ca_crt_unverified
(
self
):
parameter_dict
=
self
.
assertSlaveBase
(
'ssl-proxy-verify_ssl_proxy_ca_crt-unverified'
)
...
...
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