Skip to content

Commit

Permalink
turn on logging by default (to /var/log/caddy/access.log)
Browse files Browse the repository at this point in the history
  • Loading branch information
traceypooh committed Jan 5, 2024
1 parent e749e4d commit 3a0a58a
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions etc/Caddyfile.ctmpl
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
{{ range env "ON_DEMAND_TLS_ASK" | split "!" }}
{
on_demand_tls {
ask {{ env "ON_DEMAND_TLS_ASK" }}
interval 1m
burst 10
{{ range env "ON_DEMAND_TLS_ASK" | split "!" }}
on_demand_tls {
ask {{ env "ON_DEMAND_TLS_ASK" }}
interval 1m
burst 10
}
{{ end }}

log {
output file /var/log/caddy/access.log
}
}
{{ end }}

# unknown hostnames go to 404 page
http:// {
Expand All @@ -24,6 +28,7 @@ https://{{- . }} {
on_demand
}
{{ end }}
log
}
http://{{- . }} {
redir https://{host}{uri} permanent
Expand All @@ -38,6 +43,7 @@ http://{{- . }} {
on_demand
}
{{ end }}
log
}


Expand All @@ -52,6 +58,7 @@ http://{{- . }} {
on_demand
}
{{ end }}
log
}
{{ else if . | regexMatch "^http://" }}
{{ $hosty }} {
Expand All @@ -65,6 +72,7 @@ https://{{ $hosty }} {
on_demand
}
{{ end }}
log
}
http://{{ $hosty }} {
redir https://{host}{uri} permanent
Expand Down Expand Up @@ -115,6 +123,7 @@ http://{{ $hosty }} {
on_demand
}
{{ end }}
log
}

{{- if $origin | regexReplaceAll "^https://" "" | regexMatch ":" }}{{- else }}
Expand All @@ -129,6 +138,7 @@ http://{{ $origin | regexReplaceAll "^https://" "" }} {
reverse_proxy {{ range $services }} {{ .Address }}:{{ .Port }} {{ end }} {
lb_policy least_conn
}
log
}
{{- end -}}

Expand All @@ -141,6 +151,7 @@ http://{{ $origin | regexReplaceAll "^https://" "" }} {
reverse_proxy {{ range $services }} {{ .Address }}:{{ .Port }} {{ end }} {
lb_policy least_conn
}
log
}


Expand Down

0 comments on commit 3a0a58a

Please sign in to comment.