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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Roque
slapos
Commits
578dc7fc
Commit
578dc7fc
authored
Sep 07, 2022
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rapid-cdn: c->h: Implement type:zope
Adapt tests to cleaner responses from Haproxy.
parent
75ecdc6a
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
66 deletions
+18
-66
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
-61
software/rapid-cdn/templates/frontend-haproxy.cfg.in
software/rapid-cdn/templates/frontend-haproxy.cfg.in
+14
-0
software/rapid-cdn/test/test.py
software/rapid-cdn/test/test.py
+3
-3
software/rapid-cdn/test/test_data/test.TestSlave.test00file_list_log.txt
...cdn/test/test_data/test.TestSlave.test00file_list_log.txt
+0
-1
No files found.
software/rapid-cdn/buildout.hash.cfg
View file @
578dc7fc
...
...
@@ -38,7 +38,7 @@ md5sum = cba4d995962f7fbeae3f61c9372c4181
[template-frontend-haproxy-configuration]
_update_hash_filename_ = templates/frontend-haproxy.cfg.in
md5sum = e
6028533463b9da84c122ceb22ee0423
md5sum = e
73d1b96224cac7d866b0d2e1eecfecb
[template-frontend-haproxy-crt-list]
_update_hash_filename_ = templates/frontend-haproxy-crt-list.in
...
...
software/rapid-cdn/templates/default-virtualhost.conf.in
View file @
578dc7fc
...
...
@@ -2,11 +2,6 @@
{%- if slave_parameter['prefer-gzip-encoding-to-backend'] %}
{%- do proxy_append_list.append(('prefer-gzip', 'Proxy which always overrides Accept-Encoding to gzip if such is found')) %}
{%- endif %} {#- if slave_parameter['prefer-gzip-encoding-to-backend'] #}
{%- if slave_parameter['path'].strip().strip('/') %}
{%- set zope_path = slave_parameter['path'].strip().strip('/') ~ '/' %}
{%- else %}
{%- set zope_path = '' %}
{%- endif %}
{%- set http_host_list = [] %}
{%- set https_host_list = [] %}
{%- for host in slave_parameter['host_list'] %}
...
...
@@ -69,60 +64,10 @@
redir 302 {
/ https://{host}{rewrite_uri}
}
{%- elif slave_parameter['type'] == 'zope' and backend_url %}
# Zope configuration
{%- for (proxy_name, proxy_comment) in proxy_append_list %}
# {{ proxy_comment }}
proxy "/{{ proxy_name }}" {{ backend_url }} {
{{ proxy_header() }}
{{ hsts_header(tls) }}
{%- if proxy_name == 'prefer-gzip' %}
without /prefer-gzip
header_upstream Accept-Encoding gzip
{%- endif %} {#- if proxy_name == 'prefer-gzip' #}
{%- if slave_parameter['disable-no-cache-request'] %}
header_upstream -Cache-Control
header_upstream -Pragma
{%- endif %} {#- if slave_parameter['disable-no-cache-request'] #}
transparent
} {# proxy #}
{%- endfor %} {#- for (proxy_name, proxy_comment) in proxy_append_list #}
{%- if slave_parameter['default-path'] %}
redir 301 {
if {path} is /
/ {scheme}://{host}/{{ slave_parameter['default-path'] }}
} {# redir #}
{%- endif %} {#- if slave_parameter['default-path'] #}
{%- if slave_parameter['prefer-gzip-encoding-to-backend'] and not (not tls and slave_parameter['https-only']) %}
rewrite {
regexp (.*)
if {>Accept-Encoding} match "(^gzip,.*|.*, gzip,.*|.*, gzip$|^gzip$)"
{%- if tls %}
to /prefer-gzip/VirtualHostBase/{scheme}%2F{hostonly}:{{ slave_parameter['virtualhostroot-https-port'] }}%2F{{ zope_path }}VirtualHostRoot/{1}
{%- else %}
to /prefer-gzip/VirtualHostBase/{scheme}%2F{hostonly}:{{ slave_parameter['virtualhostroot-http-port'] }}%2F{{ zope_path }}VirtualHostRoot/{1}
{%- endif %}
}
rewrite {
regexp (.*)
if {>Accept-Encoding} not_match "(^gzip,.*|.*, gzip,.*|.*, gzip$|^gzip$)"
{%- if tls %}
to /VirtualHostBase/{scheme}%2F{hostonly}:{{ slave_parameter['virtualhostroot-https-port'] }}%2F{{ zope_path }}VirtualHostRoot/{1}
{%- else %}
to /VirtualHostBase/{scheme}%2F{hostonly}:{{ slave_parameter['virtualhostroot-http-port'] }}%2F{{ zope_path }}VirtualHostRoot/{1}
{%- endif %}
}
{%- else %}
rewrite {
regexp (.*)
{%- if tls %}
to /VirtualHostBase/{scheme}%2F{hostonly}:{{ slave_parameter['virtualhostroot-https-port'] }}%2F{{ zope_path }}VirtualHostRoot/{1}
{%- else %}
to /VirtualHostBase/{scheme}%2F{hostonly}:{{ slave_parameter['virtualhostroot-http-port'] }}%2F{{ zope_path }}VirtualHostRoot/{1}
{%- endif %}
} {# rewrite #}
{%- endif %} {#- if slave_parameter['prefer-gzip-encoding-to-backend'] #}
{%- elif slave_parameter['type'] == 'notebook' %}
proxy / {{ backend_url }} {
{{ proxy_header() }}
...
...
@@ -147,12 +92,6 @@
{%- endif %}
{%- else %} {#- if slave_parameter['type'] == 'zope' and backend_url #}
# Default configuration
{%- if slave_parameter['default-path'] %}
redir 301 {
if {path} is /
/ {scheme}://{host}/{{ slave_parameter['default-path'] }}
} {# redir #}
{%- endif %} {#- if slave_parameter['default-path'] #}
{%- if backend_url %}
{%- for (proxy_name, proxy_comment) in proxy_append_list %}
...
...
software/rapid-cdn/templates/frontend-haproxy.cfg.in
View file @
578dc7fc
...
...
@@ -154,6 +154,20 @@ backend {{ slave_instance['slave_reference'] }}-{{ scheme }}
http-request set-header X-Forwarded-Proto {{ scheme }}
http-request set-header X-Forwarded-Port {{ configuration[scheme + '-port'] }}
{%- endif %} {# if slave_instance['type'] == 'websocket' #}
{%- if slave_instance['type'] == 'zope' %}
{%- if slave_instance['default-path'] %}
http-request redirect location {{ scheme}}://%[hdr(host)]/{{ slave_instance['default-path'] | replace('%', '%%') }} code 301 if { path / }
{%- set not_path_acl = 'if ! { path / }' %}
{%- else %}
{%- set not_path_acl = '' %}
{%- endif %}
{%- if slave_instance['path'].strip().strip('/') %}
{%- set zope_path = slave_instance['path'].strip().strip('/').replace('%', '%%') ~ '/' %}
{%- else %}
{%- set zope_path = '' %}
{%- endif %}
http-request set-path /VirtualHostBase/{{ scheme }}/%[req.hdr(Host),field(1,:)]:{{ slave_instance['virtualhostroot-%s-port' % (scheme,)] }}/{{ zope_path }}VirtualHostRoot%[path] {{ not_path_acl }}
{%- endif %}
{%- if info_dict['path'] %}
http-request set-path {{ info_dict['path'] }}%[path]
{%- endif %} {# if info_dict['path'] #}
...
...
software/rapid-cdn/test/test.py
View file @
578dc7fc
...
...
@@ -3073,7 +3073,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
)
self
.
assertEqual
(
'https://typezope.example.com:%s/test-path/deep
/.././deep
er'
%
(
'https://typezope.example.com:%s/test-path/deeper'
%
(
HTTP_PORT
,),
result
.
headers
[
'Location'
]
)
...
...
@@ -3192,7 +3192,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
)
self
.
assertEqual
(
'https://%s:%s/test-path/deep
/.././deep
er'
%
(
'https://%s:%s/test-path/deeper'
%
(
parameter_dict
[
'domain'
],
HTTP_PORT
),
result
.
headers
[
'Location'
]
)
...
...
@@ -3233,7 +3233,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
)
self
.
assertEqual
(
'https://%s:%s/test-path/deep
/.././deep
er'
%
(
'https://%s:%s/test-path/deeper'
%
(
parameter_dict
[
'domain'
],
HTTP_PORT
),
result
.
headers
[
'Location'
]
)
...
...
software/rapid-cdn/test/test_data/test.TestSlave.test00file_list_log.txt
View file @
578dc7fc
...
...
@@ -94,7 +94,6 @@ T-2/var/log/httpd/_type-websocket-websocket-transparent-false_backend_log
T-2/var/log/httpd/_type-websocket_access_log
T-2/var/log/httpd/_type-websocket_backend_log
T-2/var/log/httpd/_type-zope-default-path_access_log
T-2/var/log/httpd/_type-zope-default-path_backend_log
T-2/var/log/httpd/_type-zope-path_access_log
T-2/var/log/httpd/_type-zope-path_backend_log
T-2/var/log/httpd/_type-zope-prefer-gzip-encoding-to-backend-https-only_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