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
Justin
slapos
Commits
78b214a2
Commit
78b214a2
authored
Jun 18, 2020
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
caddy-frontend: Improve template by using macro
parent
1693dd9d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
78 deletions
+27
-78
software/caddy-frontend/buildout.hash.cfg
software/caddy-frontend/buildout.hash.cfg
+1
-1
software/caddy-frontend/templates/default-virtualhost.conf.in
...ware/caddy-frontend/templates/default-virtualhost.conf.in
+26
-77
No files found.
software/caddy-frontend/buildout.hash.cfg
View file @
78b214a2
...
@@ -50,7 +50,7 @@ md5sum = f20d6c3d2d94fb685f8d26dfca1e822b
...
@@ -50,7 +50,7 @@ md5sum = f20d6c3d2d94fb685f8d26dfca1e822b
[template-default-slave-virtualhost]
[template-default-slave-virtualhost]
_update_hash_filename_ = templates/default-virtualhost.conf.in
_update_hash_filename_ = templates/default-virtualhost.conf.in
md5sum =
cb3f7ace99346f64f2007c3e94b0580
0
md5sum =
a72e9056eeda3c7c794f6f656005638
0
[template-cached-slave-virtualhost]
[template-cached-slave-virtualhost]
_update_hash_filename_ = templates/cached-virtualhost.conf.in
_update_hash_filename_ = templates/cached-virtualhost.conf.in
...
...
software/caddy-frontend/templates/default-virtualhost.conf.in
View file @
78b214a2
...
@@ -40,6 +40,25 @@
...
@@ -40,6 +40,25 @@
{%- set enable_h2 = False %}
{%- set enable_h2 = False %}
{%- endif %}
{%- endif %}
{%- macro proxy_header() %}
try_duration {{ slave_parameter['proxy_try_duration'] }}s
try_interval {{ slave_parameter['proxy_try_interval'] }}ms
timeout {{ slave_parameter['request_timeout'] }}s
{%- if ssl_proxy_verify %}
{%- if 'path_to_ssl_proxy_ca_crt' in slave_parameter %}
ca_certificates {{ slave_parameter['path_to_ssl_proxy_ca_crt'] }}
{%- endif %} {#- if 'path_to_ssl_proxy_ca_crt' in slave_parameter #}
{%- else %} {#- if ssl_proxy_verify #}
insecure_skip_verify
{%- endif %} {#- if ssl_proxy_verify #}
# force reset of X-Forwarded-For
header_upstream X-Forwarded-For {remote}
{%- if enable_cache %}
# provide a header for other components
header_upstream X-Forwarded-For-Real {remote}
{%- endif %}
{%- endmacro %} {# proxy_header #}
{%- for tls in [True, False] %}
{%- for tls in [True, False] %}
{%- if tls %}
{%- if tls %}
{%- set backend_url = slave_parameter.get('https-url', slave_parameter.get('url', '')).rstrip('/') %}
{%- set backend_url = slave_parameter.get('https-url', slave_parameter.get('url', '')).rstrip('/') %}
...
@@ -103,14 +122,7 @@
...
@@ -103,14 +122,7 @@
{%- for (proxy_name, proxy_comment) in proxy_append_list %}
{%- for (proxy_name, proxy_comment) in proxy_append_list %}
# {{ proxy_comment }}
# {{ proxy_comment }}
proxy /{{ proxy_name }} {{ backend_url }} {
proxy /{{ proxy_name }} {{ backend_url }} {
try_duration {{ slave_parameter['proxy_try_duration'] }}s
{{ proxy_header() }}
try_interval {{ slave_parameter['proxy_try_interval'] }}ms
# force reset of X-Forwarded-For
header_upstream X-Forwarded-For {remote}
{%- if enable_cache %}
# provide a header for other components
header_upstream X-Forwarded-For-Real {remote}
{%- endif %}
{%- if proxy_name == 'prefer-gzip' %}
{%- if proxy_name == 'prefer-gzip' %}
without /prefer-gzip
without /prefer-gzip
header_upstream Accept-Encoding gzip
header_upstream Accept-Encoding gzip
...
@@ -129,14 +141,6 @@
...
@@ -129,14 +141,6 @@
header_upstream -Pragma
header_upstream -Pragma
{%- endif %} {#- if disable_no_cache_header #}
{%- endif %} {#- if disable_no_cache_header #}
transparent
transparent
timeout {{ slave_parameter['request_timeout'] }}s
{%- if ssl_proxy_verify %}
{%- if 'path_to_ssl_proxy_ca_crt' in slave_parameter %}
ca_certificates {{ slave_parameter['path_to_ssl_proxy_ca_crt'] }}
{%- endif %} {#- if 'path_to_ssl_proxy_ca_crt' in slave_parameter #}
{%- else %} {#- if ssl_proxy_verify #}
insecure_skip_verify
{%- endif %} {#- if ssl_proxy_verify #}
} {# proxy #}
} {# proxy #}
{%- endfor %} {#- for (proxy_name, proxy_comment) in proxy_append_list #}
{%- endfor %} {#- for (proxy_name, proxy_comment) in proxy_append_list #}
{%- if default_path %}
{%- if default_path %}
...
@@ -181,83 +185,43 @@
...
@@ -181,83 +185,43 @@
} {# redir #}
} {# redir #}
{%- elif slave_type == 'notebook' %}
{%- elif slave_type == 'notebook' %}
proxy / {{ backend_url }} {
proxy / {{ backend_url }} {
try_duration {{ slave_parameter['proxy_try_duration'] }}s
{{ proxy_header() }}
try_interval {{ slave_parameter['proxy_try_interval'] }}ms
# force reset of X-Forwarded-For
header_upstream X-Forwarded-For {remote}
{%- if enable_cache %}
# provide a header for other components
header_upstream X-Forwarded-For-Real {remote}
{%- endif %}
transparent
transparent
insecure_skip_verify
}
}
rewrite {
rewrite {
regexp "/(api/kernels/[^/]+/(channels|iopub|shell|stdin)|terminals/websocket)/?"
regexp "/(api/kernels/[^/]+/(channels|iopub|shell|stdin)|terminals/websocket)/?"
to /proxy/{1}
to /proxy/{1}
}
}
proxy /proxy/ {{ backend_url }} {
proxy /proxy/ {{ backend_url }} {
try_duration {{ slave_parameter['proxy_try_duration'] }}s
{{ proxy_header() }}
try_interval {{ slave_parameter['proxy_try_interval'] }}ms
# force reset of X-Forwarded-For
header_upstream X-Forwarded-For {remote}
{%- if enable_cache %}
# provide a header for other components
header_upstream X-Forwarded-For-Real {remote}
{%- endif %}
transparent
transparent
websocket
websocket
without /proxy/
without /proxy/
insecure_skip_verify
}
}
{%- elif slave_type == 'websocket' %}
{%- elif slave_type == 'websocket' %}
{%- if websocket_path_list %}
{%- if websocket_path_list %}
proxy / {{ backend_url }} {
proxy / {{ backend_url }} {
try_duration {{ slave_parameter['proxy_try_duration'] }}s
{{ proxy_header() }}
try_interval {{ slave_parameter['proxy_try_interval'] }}ms
# force reset of X-Forwarded-For
header_upstream X-Forwarded-For {remote}
{%- if enable_cache %}
# provide a header for other components
header_upstream X-Forwarded-For-Real {remote}
{%- endif %}
{%- if websocket_transparent %}
{%- if websocket_transparent %}
transparent
transparent
{%- endif %}
{%- endif %}
insecure_skip_verify
}
}
{%- for websocket_path in websocket_path_list %}
{%- for websocket_path in websocket_path_list %}
proxy /{{ websocket_path }} {{ backend_url }} {
proxy /{{ websocket_path }} {{ backend_url }} {
try_duration {{ slave_parameter['proxy_try_duration'] }}s
{{ proxy_header() }}
try_interval {{ slave_parameter['proxy_try_interval'] }}ms
# force reset of X-Forwarded-For
header_upstream X-Forwarded-For {remote}
{%- if enable_cache %}
# provide a header for other components
header_upstream X-Forwarded-For-Real {remote}
{%- endif %}
websocket
websocket
{%- if websocket_transparent %}
{%- if websocket_transparent %}
transparent
transparent
{%- endif %}
{%- endif %}
insecure_skip_verify
}
}
{%- endfor %}
{%- endfor %}
{%- else %}
{%- else %}
proxy / {{ backend_url }} {
proxy / {{ backend_url }} {
try_duration {{ slave_parameter['proxy_try_duration'] }}s
{{ proxy_header() }}
try_interval {{ slave_parameter['proxy_try_interval'] }}ms
# force reset of X-Forwarded-For
header_upstream X-Forwarded-For {remote}
{%- if enable_cache %}
# provide a header for other components
header_upstream X-Forwarded-For-Real {remote}
{%- endif %}
websocket
websocket
{%- if websocket_transparent %}
{%- if websocket_transparent %}
transparent
transparent
{%- endif %}
{%- endif %}
insecure_skip_verify
}
}
{%- endif %}
{%- endif %}
{%- else %} {#- if slave_type == 'zope' and backend_url #}
{%- else %} {#- if slave_type == 'zope' and backend_url #}
...
@@ -273,14 +237,7 @@
...
@@ -273,14 +237,7 @@
{%- for (proxy_name, proxy_comment) in proxy_append_list %}
{%- for (proxy_name, proxy_comment) in proxy_append_list %}
# {{ proxy_comment }}
# {{ proxy_comment }}
proxy /{{ proxy_name }} {{ backend_url }} {
proxy /{{ proxy_name }} {{ backend_url }} {
try_duration {{ slave_parameter['proxy_try_duration'] }}s
{{ proxy_header() }}
try_interval {{ slave_parameter['proxy_try_interval'] }}ms
# force reset of X-Forwarded-For
header_upstream X-Forwarded-For {remote}
{%- if enable_cache %}
# provide a header for other components
header_upstream X-Forwarded-For-Real {remote}
{%- endif %}
{%- if proxy_name == 'prefer-gzip' %}
{%- if proxy_name == 'prefer-gzip' %}
without /prefer-gzip
without /prefer-gzip
header_upstream Accept-Encoding gzip
header_upstream Accept-Encoding gzip
...
@@ -299,14 +256,6 @@
...
@@ -299,14 +256,6 @@
header_upstream -Pragma
header_upstream -Pragma
{%- endif %} {#- if disable_no_cache_header #}
{%- endif %} {#- if disable_no_cache_header #}
transparent
transparent
timeout {{ slave_parameter['request_timeout'] }}s
{%- if ssl_proxy_verify %}
{%- if 'path_to_ssl_proxy_ca_crt' in slave_parameter %}
ca_certificates {{ slave_parameter['path_to_ssl_proxy_ca_crt'] }}
{%- endif %} {#- if 'path_to_ssl_proxy_ca_crt' in slave_parameter #}
{%- else %} {#- if ssl_proxy_verify #}
insecure_skip_verify
{%- endif %} {#- if ssl_proxy_verify #}
} {# proxy #}
} {# proxy #}
{%- endfor %} {#- for (proxy_name, proxy_comment) in proxy_append_list #}
{%- endfor %} {#- for (proxy_name, proxy_comment) in proxy_append_list #}
{%- endif %} {#- if backend_url #}
{%- endif %} {#- if backend_url #}
...
...
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