1. Caddy version (caddy version
): v2.1.1 h1:X9k1+ehZPYYrSqBvf/ocUgdLSRIuiNiMo7CvyGUQKeA=
2. How I run Caddy:
was tested CLI: caddy run --watch --config /etc/caddy/Caddyfile
a. System environment:
Lxc container, Ubuntu 18.04
b. Command:
caddy run --watch --config /etc/caddy/Caddyfile
d. My complete Caddyfile or JSON config:
{
}
(plonesnip) {
encode zstd gzip
@apiplone {
path_regexp apiplone ^/api(.*)$
}
@cachematch {
path_regexp \.(ico|jpg|jpeg|png|gif|svg|js|jsx|css|less|swf|eot|ttf|otf|woff|woff2)$
}
@cachematch2 {
path *.ico *.jpg *.jpeg *.png *.gif *.svg *.js *.jsx *.css *.less *.swf *.eot *.ttf *.otf *.woff *.woff2
}
@plone {
path_regexp plone ^/(.*)$
}
}
ata.webtide-demo.co.za {
import plonesnip
handle @apiplone {
rewrite @apiplone /VirtualHostBase/https/{host}:443/ATA/VirtualHostRoot/{re.apiplone.1}
reverse_proxy {
to localhost:8103
to localhost:8104
}
}
handle .* {
reverse_proxy {
to localhost:8101
}
header @cachematch Cache-Control public,max-age=60s
}
log {
output file /var/log/caddy/ata.access.log {
roll_size 100mb
roll_keep 30
roll_keep_for 720h
}
format json
level DEBUG
}
}
tas.webtide-demo.co.za {
import plonesnip
rewrite @plone /VirtualHostBase/https/{host}:443/TAS/VirtualHostRoot/{re.plone.1}
reverse_proxy {
to localhost:8103
to localhost:8104
}
log {
output file /var/log/caddy/tas.access.log {
roll_size 100mb
roll_keep 30
roll_keep_for 720h
}
format console
level DEBUG
}
}
3. The problem I’m having:
How do I get these in a file? where in the Caddyfile config do I add the needed for it?
(Yes, I know I could with json, but where in a Caddyfile like the above?)
2020/09/22 11:48:49.036 ERROR http.log.error.log0 dial tcp [::1]:8101: connect: connection refused {"request": {"method": "GET", "uri": "/++theme++barceloneta/barceloneta-favicon.ico", "proto": "HTTP/2.0", "remote_addr": "160.119.236.94:53173", "host": "ata.webtide-demo.co.za", "headers": {"Pragma": ["no-cache"], "Cache-Control": ["no-cache"], "Referer": ["https://ata.webtide-demo.co.za/api"], "Accept-Encoding": ["gzip, deflate, br"], "User-Agent": ["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36 Edg/85.0.564.60"], "Dnt": ["1"], "Accept": ["image/webp,image/apng,image/*,*/*;q=0.8"], "Sec-Fetch-Site": ["same-origin"], "Sec-Fetch-Mode": ["no-cors"], "Sec-Fetch-Dest": ["image"], "Accept-Language": ["en-ZA,en-GB;q=0.9,en;q=0.8,en-US;q=0.7"]}, "tls": {"resumed": false, "version": 772, "ciphersuite": 4865, "proto": "h2", "proto_mutual": true, "server_name": "ata.webtide-demo.co.za"}}, "duration": 0.000544758, "status": 502, "err_id": "mzt1jrnvj", "err_trace": "reverseproxy.(*Handler).ServeHTTP (reverseproxy.go:411)"}
4. Error messages and/or full log output:
2020/09/22 11:48:49.036 ERROR http.log.error.log0 dial tcp [::1]:8101: connect: connection refused {"request": {"method": "GET", "uri": "/++theme++barceloneta/barceloneta-favicon.ico", "proto": "HTTP/2.0", "remote_addr": "160.119.236.94:53173", "host": "ata.webtide-demo.co.za", "headers": {"Pragma": ["no-cache"], "Cache-Control": ["no-cache"], "Referer": ["https://ata.webtide-demo.co.za/api"], "Accept-Encoding": ["gzip, deflate, br"], "User-Agent": ["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36 Edg/85.0.564.60"], "Dnt": ["1"], "Accept": ["image/webp,image/apng,image/*,*/*;q=0.8"], "Sec-Fetch-Site": ["same-origin"], "Sec-Fetch-Mode": ["no-cors"], "Sec-Fetch-Dest": ["image"], "Accept-Language": ["en-ZA,en-GB;q=0.9,en;q=0.8,en-US;q=0.7"]}, "tls": {"resumed": false, "version": 772, "ciphersuite": 4865, "proto": "h2", "proto_mutual": true, "server_name": "ata.webtide-demo.co.za"}}, "duration": 0.000544758, "status": 502, "err_id": "mzt1jrnvj", "err_trace": "reverseproxy.(*Handler).ServeHTTP (reverseproxy.go:411)"}
5. What I already tried:
can’t have it “standalone”, neither does it work in the global section, so I’m quite baffled where to add the needed to get those logged to file