2019-02-01 18:50:35 +01:00
|
|
|
{{ vhost_url }} {
|
|
|
|
|
|
|
|
header / {
|
|
|
|
# Enable HTTP Strict Transport Security (HSTS) to force clients to always
|
|
|
|
# connect via HTTPS (do not use if only testing)
|
|
|
|
Strict-Transport-Security "max-age=31536000;"
|
|
|
|
# Enable cross-site filter (XSS) and tell browser to block detected attacks
|
|
|
|
X-XSS-Protection "1; mode=block"
|
|
|
|
# Prevent some browsers from MIME-sniffing a response away from the declared Content-Type
|
|
|
|
X-Content-Type-Options "nosniff"
|
|
|
|
# Disallow the site to be rendered within a frame (clickjacking protection)
|
|
|
|
X-Frame-Options "DENY"
|
|
|
|
}
|
|
|
|
|
2020-05-19 21:27:29 +02:00
|
|
|
log {
|
|
|
|
output file {{ caddy_logs }}/{{ vhost_name }}/vhost.log
|
2019-02-01 18:50:35 +01:00
|
|
|
}
|
|
|
|
|
2020-05-19 21:27:29 +02:00
|
|
|
root * {{ caddy_www }}/{{ vhost_name }}
|
|
|
|
file_server
|
|
|
|
encode zstd gzip
|
|
|
|
|
|
|
|
{% if custom_errors %}
|
|
|
|
handle_errors {
|
|
|
|
@404 {
|
|
|
|
expression {http.error.status_code} == 404
|
|
|
|
}
|
|
|
|
rewrite @404 /404.html
|
|
|
|
file_server
|
2020-03-19 16:43:36 +01:00
|
|
|
}
|
2020-05-19 21:27:29 +02:00
|
|
|
{% endif %}
|
2019-02-01 18:50:35 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
{% if www_redirect %}
|
|
|
|
www.{{ vhost_url }} {
|
|
|
|
|
|
|
|
redir https://{{ vhost_url }}
|
|
|
|
|
|
|
|
}
|
2020-04-03 11:44:03 +02:00
|
|
|
{% endif %}
|