Commit 03428fb3 authored by Łukasz Nowak's avatar Łukasz Nowak

caddy-frontend: Implement notfound.html on 404

parent 72ac8649
...@@ -19,7 +19,7 @@ md5sum = 906e5bd66b1265b8109a86b6ab46e91f ...@@ -19,7 +19,7 @@ md5sum = 906e5bd66b1265b8109a86b6ab46e91f
[template-apache-frontend] [template-apache-frontend]
filename = instance-apache-frontend.cfg filename = instance-apache-frontend.cfg
md5sum = a657a0d40ba17d1f8a55602eacdb6c76 md5sum = c17bd03e23b7ab5f642f43d5fb3f2522
[template-apache-replicate] [template-apache-replicate]
filename = instance-apache-replicate.cfg.in filename = instance-apache-replicate.cfg.in
...@@ -27,7 +27,7 @@ md5sum = 361054e6566461e728ee62e2835904f9 ...@@ -27,7 +27,7 @@ md5sum = 361054e6566461e728ee62e2835904f9
[template-slave-list] [template-slave-list]
filename = templates/apache-custom-slave-list.cfg.in filename = templates/apache-custom-slave-list.cfg.in
md5sum = 5e625fd08713d01184e8665aae6759fc md5sum = 10d3f1a3be413208a8cf8ee6e3d735ed
[template-slave-configuration] [template-slave-configuration]
filename = templates/custom-virtualhost.conf.in filename = templates/custom-virtualhost.conf.in
...@@ -39,11 +39,11 @@ md5sum = 665e83d660c9b779249b2179d7ce4b4e ...@@ -39,11 +39,11 @@ md5sum = 665e83d660c9b779249b2179d7ce4b4e
[template-caddy-frontend-configuration] [template-caddy-frontend-configuration]
filename = templates/Caddyfile.in filename = templates/Caddyfile.in
md5sum = aba04d6e54bdc56c0f2c15fbb712aa3a md5sum = 2c9d8a41132cc5de31d09ad8af47fa22
[template-custom-slave-list] [template-custom-slave-list]
filename = templates/apache-custom-slave-list.cfg.in filename = templates/apache-custom-slave-list.cfg.in
md5sum = 5e625fd08713d01184e8665aae6759fc md5sum = 10d3f1a3be413208a8cf8ee6e3d735ed
[template-not-found-html] [template-not-found-html]
filename = templates/notfound.html filename = templates/notfound.html
...@@ -59,7 +59,7 @@ md5sum = be76c0e96df722dee278077988d869a6 ...@@ -59,7 +59,7 @@ md5sum = be76c0e96df722dee278077988d869a6
[template-log-access] [template-log-access]
filename = templates/template-log-access.conf.in filename = templates/template-log-access.conf.in
md5sum = fae1e2fc29c061f7bbb455b9efb9c3b3 md5sum = 0867232c154e427b9e0f1af7fd694ebb
[template-empty] [template-empty]
filename = templates/empty.in filename = templates/empty.in
......
...@@ -201,6 +201,7 @@ extra-context = ...@@ -201,6 +201,7 @@ extra-context =
key enable_http2_by_default instance-parameter:configuration.enable-http2-by-default key enable_http2_by_default instance-parameter:configuration.enable-http2-by-default
key access_log caddy-configuration:access-log key access_log caddy-configuration:access-log
key error_log caddy-configuration:error-log key error_log caddy-configuration:error-log
key not_found_file caddy-configuration:not-found-file
[dynamic-virtualhost-template-slave] [dynamic-virtualhost-template-slave]
<= jinja2-template-base <= jinja2-template-base
...@@ -242,6 +243,7 @@ extra-context = ...@@ -242,6 +243,7 @@ extra-context =
key local_ipv4 instance-parameter:ipv4-random key local_ipv4 instance-parameter:ipv4-random
key global_ipv6 slap-network-information:global-ipv6 key global_ipv6 slap-network-information:global-ipv6
key error_log caddy-configuration:error-log key error_log caddy-configuration:error-log
key not_found_file caddy-configuration:not-found-file
key username slap-parameter:monitor-username key username slap-parameter:monitor-username
key password slap-parameter:monitor-password key password slap-parameter:monitor-password
...@@ -290,7 +292,7 @@ protected-path = / ...@@ -290,7 +292,7 @@ protected-path = /
access-control-string = none access-control-string = none
frontend-configuration-verification = $${caddy-wrapper:rendered} -validate > /dev/null frontend-configuration-verification = $${caddy-wrapper:rendered} -validate > /dev/null
frontend-graceful-command = $${:frontend-configuration-verification}; if [ $? -eq 0 ]; then kill -USR1 $(cat $${:pid-file}); fi frontend-graceful-command = $${:frontend-configuration-verification}; if [ $? -eq 0 ]; then kill -USR1 $(cat $${:pid-file}); fi
not-found-file = $${caddy-directory:document-root}/notfound.html
# Comunication with ats # Comunication with ats
cache-port = $${trafficserver-variable:input-port} cache-port = $${trafficserver-variable:input-port}
cache-through-port = 26011 cache-through-port = 26011
......
...@@ -121,7 +121,9 @@ import {{ slave_with_cache_configuration_directory }}/*.conf ...@@ -121,7 +121,9 @@ import {{ slave_with_cache_configuration_directory }}/*.conf
# TODO-Caddy LogLevel notice # TODO-Caddy LogLevel notice
# TODO-Caddy LogFormat "%h %l %{REMOTE_USER}i %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %D" combined # TODO-Caddy LogFormat "%h %l %{REMOTE_USER}i %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %D" combined
log / {{ access_log }} {combined} log / {{ access_log }} {combined}
errors {{ error_log }} errors {{ error_log }} {
* {{ not_found_file }}
}
} }
https://[{{ global_ipv6 }}]:{{ https_port }}/server-status, https://{{ local_ipv4 }}:{{ https_port }}/server-status { https://[{{ global_ipv6 }}]:{{ https_port }}/server-status, https://{{ local_ipv4 }}:{{ https_port }}/server-status {
...@@ -136,17 +138,16 @@ https://[{{ global_ipv6 }}]:{{ https_port }}/server-status, https://{{ local_ipv ...@@ -136,17 +138,16 @@ https://[{{ global_ipv6 }}]:{{ https_port }}/server-status, https://{{ local_ipv
# TODO-Caddy LogLevel notice # TODO-Caddy LogLevel notice
# TODO-Caddy LogFormat "%h %l %{REMOTE_USER}i %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %D" combined # TODO-Caddy LogFormat "%h %l %{REMOTE_USER}i %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %D" combined
log / {{ access_log }} {combined} log / {{ access_log }} {combined}
errors {{ error_log }} errors {{ error_log }} {
* {{ not_found_file }}
}
} }
:{{ http_port }} { :{{ http_port }} {
bind {{ local_ipv4 }} bind {{ local_ipv4 }}
status 404 / status 404 /
# TODO-Caddy LogLevel notice log / {{ access_log }} "{remote} {>REMOTE_USER} [{when}] \"{method} {uri} {proto}\" {status} {size} \"{>Referer}\" \"{>User-Agent}\" {latency_ms}"
# TODO-Caddy LogFormat "%h %l %{REMOTE_USER}i %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %D" combined errors {{ error_log }} {
log / {{ access_log }} {combined} * {{ not_found_file }}
errors {{ error_log }} }
} }
# TODO-Caddy ErrorDocument 404 /notfound.html
# TODO-Caddy RewriteRule (.*) /notfound.html [R=404,L]
...@@ -380,6 +380,7 @@ extra-context = ...@@ -380,6 +380,7 @@ extra-context =
raw login_key {{ login_key }} raw login_key {{ login_key }}
raw access_log {{ access_log }} raw access_log {{ access_log }}
raw error_log {{ error_log }} raw error_log {{ error_log }}
raw not_found_file {{ not_found_file }}
{# Publish information for the instance #} {# Publish information for the instance #}
[publish-caddy-information] [publish-caddy-information]
......
...@@ -11,6 +11,8 @@ https://[{{ global_ipv6 }}]:{{ https_port }}/{{ slave }}, https://{{ local_ipv4 ...@@ -11,6 +11,8 @@ https://[{{ global_ipv6 }}]:{{ https_port }}/{{ slave }}, https://{{ local_ipv4
# TODO-Caddy LogLevel notice # TODO-Caddy LogLevel notice
# TODO-Caddy LogFormat "%h %l %{REMOTE_USER}i %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %D" combined # TODO-Caddy LogFormat "%h %l %{REMOTE_USER}i %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %D" combined
log / {{ access_log }} {combined} log / {{ access_log }} {combined}
errors {{ error_log }} errors {{ error_log }} {
* {{ not_found_file }}
}
} }
{% endfor %} {% endfor %}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment