Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
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
5
Merge Requests
5
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
slapos
Commits
836768fd
Commit
836768fd
authored
Aug 29, 2022
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rapid-cdn: c->h: Implement not found instance
parent
e5b2a05c
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
12 deletions
+18
-12
software/rapid-cdn/buildout.hash.cfg
software/rapid-cdn/buildout.hash.cfg
+3
-3
software/rapid-cdn/instance-frontend.cfg.in
software/rapid-cdn/instance-frontend.cfg.in
+1
-9
software/rapid-cdn/templates/frontend-haproxy.cfg.in
software/rapid-cdn/templates/frontend-haproxy.cfg.in
+9
-0
software/rapid-cdn/templates/notfound.html
software/rapid-cdn/templates/notfound.html
+5
-0
No files found.
software/rapid-cdn/buildout.hash.cfg
View file @
836768fd
...
...
@@ -22,7 +22,7 @@ md5sum = 5784bea3bd608913769ff9a8afcccb68
[profile-frontend]
filename = instance-frontend.cfg.in
md5sum =
3eb6adca77906f7b2c40b6f7f28c4bec
md5sum =
b519b264956ad6ee43615ee535f41e6d
[profile-master]
filename = instance-master.cfg.in
...
...
@@ -38,7 +38,7 @@ md5sum = cba4d995962f7fbeae3f61c9372c4181
[template-frontend-haproxy-configuration]
_update_hash_filename_ = templates/frontend-haproxy.cfg.in
md5sum =
d115e229b7b76bcc6aba4ba62e887ccb
md5sum =
cab77efb4f7a3bd0a932055d33583640
[template-frontend-haproxy-crt-list]
_update_hash_filename_ = templates/frontend-haproxy-crt-list.in
...
...
@@ -46,7 +46,7 @@ md5sum = f444c9735e5247faba26831fda6f27f9
[template-not-found-html]
_update_hash_filename_ = templates/notfound.html
md5sum =
88af61e7abbf30dc99a1a2526161128d
md5sum =
d56e2cfab274cbbbe5b387f2f6e417df
[template-backend-haproxy-configuration]
_update_hash_filename_ = templates/backend-haproxy.cfg.in
...
...
software/rapid-cdn/instance-frontend.cfg.in
View file @
836768fd
...
...
@@ -423,7 +423,6 @@ extra-context =
key global_ipv6 slap-configuration:ipv6-random
key local_ipv4 :local_ipv4
key error_log frontend-haproxy-configuration:error-log
key not_found_file frontend-haproxy-configuration:not-found-file
key username monitor-instance-parameter:username
key password monitor-htpasswd:passwd
# BBB: SlapOS Master non-zero knowledge BEGIN
...
...
@@ -458,7 +457,7 @@ access-log = ${directory:log}/frontend-access.log
error-log = ${directory:log}/frontend-error.log
pid-file = ${directory:run}/httpd.pid
frontend-graceful-command = ${frontend-haproxy-validate:output} && kill -USR2 $(cat ${:pid-file})
not-found-file =
${frontend-directory:document-root}/${not-found-html:filename
}
not-found-file =
{{ software_parameter_dict['template_not_found_html'] }
}
master-certificate = ${frontend-directory:master-autocert-dir}/master.pem
self-signed-fallback-certificate = ${self-signed-fallback-access:certificate}
http-port = ${configuration:plain_http_port}
...
...
@@ -499,15 +498,8 @@ context =
output = ${directory:bbb-ssl-dir}/frontend.crt
# BBB: SlapOS Master non-zero knowledge END
[not-found-html]
recipe = plone.recipe.command
update-command = ${:command}
filename = notfound.html
command = ln -sf {{ software_parameter_dict['template_not_found_html'] }} ${frontend-directory:document-root}/${:filename}
[frontend-directory]
recipe = slapos.cookbook:mkdirectory
document-root = ${directory:srv}/htdocs
slave-configuration = ${directory:etc}/frontend-haproxy.d/
slave-log = ${directory:log}/httpd
autocert = ${directory:srv}/autocert
...
...
software/rapid-cdn/templates/frontend-haproxy.cfg.in
View file @
836768fd
...
...
@@ -69,6 +69,7 @@ frontend http-frontend
{%- for slave_instance in frontend_slave_list -%}
{{ frontend_entry(slave_instance, 'http', True) }}
{%- endfor %}
default_backend BACKEND_NOT_FOUND
frontend https-frontend
bind {{ configuration['local-ipv4'] }}:{{ configuration['https-port'] }} ssl crt-list {{ crt_list }}
...
...
@@ -80,6 +81,7 @@ frontend https-frontend
{%- for slave_instance in frontend_slave_list -%}
{{ frontend_entry(slave_instance, 'https', True) }}
{%- endfor %}
default_backend BACKEND_NOT_FOUND
# Backends
{%- for slave_instance in frontend_slave_list %}
...
...
@@ -119,4 +121,11 @@ backend {{ slave_instance['slave_reference'] }}-{{ scheme }}
{%- endif %} {# if scheme == 'http' and slave_instance['https-only'] #}
{%- endfor %} {# for (scheme, prefix) in SCHEME_PREFIX_MAPPING.items() #}
{%- endfor %} {# for slave_instance in frontend_slave_list #}
backend BACKEND_NOT_FOUND
{#- a bit hacky but working way to provide default CDN's 404 #}
{#- inspired by https://sleeplessbeastie.eu/2020/05/11/how-to-serve-single-file-using-haproxy/ #}
http-request set-log-level silent
errorfile 503 {{ configuration['not-found-file'] }}
{# END OF FILE #}
software/rapid-cdn/templates/notfound.html
View file @
836768fd
HTTP/1.0 404 Not Found
Cache-Control: no-cache
Connection: close
Content-Type: text/html
<html>
<head>
<title>
Instance not found
</title>
...
...
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