Commit b067406d authored by Łukasz Nowak's avatar Łukasz Nowak

caddy-frontend: Implement global catch-all with 404

404 is served with notfound.html
parent 4300660a
......@@ -18,7 +18,7 @@ md5sum = 906e5bd66b1265b8109a86b6ab46e91f
[template-apache-frontend]
filename = instance-apache-frontend.cfg
md5sum = 6ed51a3629d8eca72fc58cda652aea19
md5sum = 8a32eebd4dcdbed9442ebbfd64a0fab1
[template-apache-replicate]
filename = instance-apache-replicate.cfg.in
......@@ -26,7 +26,7 @@ md5sum = 361054e6566461e728ee62e2835904f9
[template-slave-list]
filename = templates/apache-custom-slave-list.cfg.in
md5sum = 353d68f9ba6a318fd7ce0461d3bbc2c7
md5sum = 904084604341fe8eb00d493cd05e46c0
[template-slave-configuration]
filename = templates/custom-virtualhost.conf.in
......@@ -38,11 +38,11 @@ md5sum = 665e83d660c9b779249b2179d7ce4b4e
[template-caddy-frontend-configuration]
filename = templates/Caddyfile.in
md5sum = a8765b3c3af9f4f4f6437028aa42c58f
md5sum = 66975b5c3c3544c365b93e2ae58531f8
[template-custom-slave-list]
filename = templates/apache-custom-slave-list.cfg.in
md5sum = 353d68f9ba6a318fd7ce0461d3bbc2c7
md5sum = 904084604341fe8eb00d493cd05e46c0
[template-not-found-html]
filename = templates/notfound.html
......@@ -58,7 +58,7 @@ md5sum = 7a1fa1239f29cf1a3f6f578f6ff05ca3
[template-log-access]
filename = templates/template-log-access.conf.in
md5sum = fae1e2fc29c061f7bbb455b9efb9c3b3
md5sum = 0867232c154e427b9e0f1af7fd694ebb
[template-empty]
filename = templates/empty.in
......
......@@ -201,6 +201,7 @@ extra-context =
key error_log caddy-configuration:error-log
raw sixtunnel_executable ${6tunnel:location}/bin/6tunnel
raw service_directory $${directory:service}
key not_found_file caddy-configuration:not-found-file
[dynamic-virtualhost-template-slave]
<= jinja2-template-base
......@@ -221,7 +222,6 @@ rendered = $${caddy-configuration:frontend-configuration}
extra-context =
key httpd_home software-release-path:caddy-location
key httpd_mod_ssl_cache_directory caddy-directory:mod-ssl
key document_root caddy-directory:document-root
key instance_home buildout:directory
key server_admin instance-parameter:configuration.server-admin
key login_certificate ca-frontend:cert-file
......@@ -240,6 +240,7 @@ extra-context =
key local_ipv4 instance-parameter:ipv4-random
key global_ipv6 slap-network-information:global-ipv6
key error_log caddy-configuration:error-log
key not_found_file caddy-configuration:not-found-file
key username slap-parameter:monitor-username
key password slap-parameter:monitor-password
......@@ -286,7 +287,7 @@ error-log = $${directory:log}/frontend-error.log
pid-file = $${directory:run}/httpd.pid
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
not-found-file = $${caddy-directory:document-root}/notfound.html
# Comunication with ats
cache-port = $${trafficserver-variable:input-port}
cache-through-port = 26011
......
# Automatically generated
# As backend is trusting REMOTE_USER header unset it always
# TODO-Caddy RequestHeader unset REMOTE_USER
# TODO-Caddy <Directory {{ document_root }}>
# TODO-Caddy Require all granted
# TODO-Caddy Options -Indexes
# TODO-Caddy ErrorDocument 404 /notfound.html
# TODO-Caddy RewriteEngine on
# TODO-Caddy RewriteRule ^/?$ notfound.html [R=404,L]
# TODO-Caddy </Directory>
# The following directives modify normal HTTP response behavior to
# handle known problems with browser implementations.
# TODO-Caddy BrowserMatch "Mozilla/2" nokeepalive
......@@ -57,14 +46,16 @@ import {{frontend_configuration.get('log-access-configuration')}}
import {{ slave_configuration_directory }}/*.conf
import {{ slave_with_cache_configuration_directory }}/*.conf
https://[{{ global_ipv6 }}]:{{ https_port }}/, https://{{ local_ipv4 }}:{{ https_port }}/ {
:{{ https_port }} {
tls {{ login_certificate }} {{ login_key }}
bind {{ local_ipv4 }}
status 404 /
# TODO-Caddy LogLevel notice
# TODO-Caddy LogFormat "%h %l %{REMOTE_USER}i %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %D" 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 {
......@@ -79,17 +70,16 @@ https://[{{ global_ipv6 }}]:{{ https_port }}/server-status, https://{{ local_ipv
# TODO-Caddy LogLevel notice
# TODO-Caddy LogFormat "%h %l %{REMOTE_USER}i %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %D" combined
log / {{ access_log }} {combined}
errors {{ error_log }}
errors {{ error_log }} {
* {{ not_found_file }}
}
}
http://[{{ global_ipv6 }}]:{{ http_port }}/, http://{{ local_ipv4 }}:{{ http_port }}/ {
:{{ http_port }} {
bind {{ local_ipv4 }}
status 404 /
# TODO-Caddy LogLevel notice
# TODO-Caddy LogFormat "%h %l %{REMOTE_USER}i %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %D" combined
log / {{ access_log }} {combined}
errors {{ error_log }}
log / {{ access_log }} "{remote} {>REMOTE_USER} [{when}] \"{method} {uri} {proto}\" {status} {size} \"{>Referer}\" \"{>User-Agent}\" {latency_ms}"
errors {{ error_log }} {
* {{ not_found_file }}
}
}
# TODO-Caddy ErrorDocument 404 /notfound.html
# TODO-Caddy RewriteRule (.*) /notfound.html [R=404,L]
......@@ -380,6 +380,7 @@ extra-context =
raw login_key {{ login_key }}
raw access_log {{ access_log }}
raw error_log {{ error_log }}
raw not_found_file {{ not_found_file }}
{# Publish information for the instance #}
[publish-caddy-information]
......
......@@ -11,6 +11,8 @@ https://[{{ global_ipv6 }}]:{{ https_port }}/{{ slave }}, https://{{ local_ipv4
# TODO-Caddy LogLevel notice
# TODO-Caddy LogFormat "%h %l %{REMOTE_USER}i %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %D" combined
log / {{ access_log }} {combined}
errors {{ error_log }}
errors {{ error_log }} {
* {{ not_found_file }}
}
}
{% 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