1. Caddy version (caddy version
):
╰─ caddy version
v2.4.6 h1:HGkGICFGvyrodcqOOclHKfvJC0qTU7vny/7FhYp9hNw=
2. How I run Caddy:
via a Caddyfile with the following
cdn.company.local {
uri strip_prefix /staging
@isIn0 file {
root /path/to/phase0/dist
}
handle @isIn0 {
root * /path/to/phase0/dist
file_server
}
@isIn1 file {
root /path/to/phase1/dist
}
handle @isIn1 {
root * /path/to/phase1/dist
file_server
}
handle {
rewrite * /dist/{path}
reverse_proxy http://localhost:8092 {
lb_policy first
health_status 200
unhealthy_status 502
health_uri /
fail_duration 1s
}
}
handle_errors {
uri strip_prefix /staging
root * /path/to/phase2/dist
file_server
}
}
a. System environment:
Running directly on my m1 macbook pro and also for some people on x86 macbook pro and for others on ubuntu 21.04 in windows WSL
b. Command:
caddy run
c. Service/unit/compose file:
N/A
d. My complete Caddyfile or JSON config:
same as (2)
3. The problem I’m having:
The configuration works as intended.
If the path is in phase0 on disk it serves from that location, if it’s from phase1 on disk it serves from that location, otherwise if my localhost:8092 is up it serves from there, otherwise it serves from phase2 on disk
I just want to do it in a way that doesn’t make caddy keep complaining localhost:8092 isn’t running when it isn’t cause it’s normal for that situation and it creates noise I don’t want.
4. Error messages and/or full log output:
2022/02/15 01:45:15.679 INFO using adjacent Caddyfile
2022/02/15 01:45:15.686 WARN input is not formatted with 'caddy fmt' {"adapter": "caddyfile", "file": "Caddyfile", "line": 2}
2022/02/15 01:45:15.688 INFO admin admin endpoint started {"address": "tcp/localhost:2019", "enforce_origin": false, "origins": ["localhost:2019", "[::1]:2019", "127.0.0.1:2019"]}
2022/02/15 01:45:15.688 INFO tls.cache.maintenance started background certificate maintenance {"cache": "0x140003be770"}
2022/02/15 01:45:15.688 INFO http server is listening only on the HTTPS port but has no TLS connection policies; adding one to enable TLS {"server_name": "srv0", "https_port": 443}
2022/02/15 01:45:15.688 INFO http enabling automatic HTTP->HTTPS redirects {"server_name": "srv0"}
2022/02/15 01:45:15.691 INFO http.handlers.reverse_proxy.health_checker.active HTTP request failed {"host": "localhost:8092", "error": "Get \"http://localhost:8092/\": dial tcp [::1]:8092: connect: connection refused"}
2022/02/15 01:45:15.784 INFO pki.ca.local root certificate is already trusted by system {"path": "storage:pki/authorities/local/root.crt"}
2022/02/15 01:45:15.785 INFO http enabling automatic TLS certificate management {"domains": ["cdn.company.local"]}
2022/02/15 01:45:15.785 INFO tls cleaning storage unit {"description": "FileStorage:/Users/stephenm/Library/Application Support/Caddy"}
2022/02/15 01:45:15.785 INFO autosaved config (load with --resume flag) {"file": "/Users/stephenm/Library/Application Support/Caddy/autosave.json"}
2022/02/15 01:45:15.785 INFO serving initial configuration
2022/02/15 01:45:15.786 INFO tls.obtain acquiring lock {"identifier": "cdn.company.local"}
2022/02/15 01:45:15.790 INFO tls finished cleaning storage units
2022/02/15 01:45:15.807 INFO tls.obtain lock acquired {"identifier": "cdn.company.local"}
2022/02/15 01:45:15.808 INFO tls.obtain certificate obtained successfully {"identifier": "cdn.company.local"}
2022/02/15 01:45:15.808 INFO tls.obtain releasing lock {"identifier": "cdn.company.local"}
2022/02/15 01:45:15.808 WARN tls stapling OCSP {"error": "no OCSP stapling for [cdn.company.local]: no OCSP server specified in certificate"}
2022/02/15 01:45:45.693 INFO http.handlers.reverse_proxy.health_checker.active HTTP request failed {"host": "localhost:8092", "error": "Get \"http://localhost:8092/\": dial tcp [::1]:8092: connect: connection refused"}
2022/02/15 01:46:15.693 INFO http.handlers.reverse_proxy.health_checker.active HTTP request failed {"host": "localhost:8092", "error": "Get \"http://localhost:8092/\": dial tcp [::1]:8092: connect: connection refused"}
2022/02/15 01:46:45.692 INFO http.handlers.reverse_proxy.health_checker.active HTTP request failed {"host": "localhost:8092", "error": "Get \"http://localhost:8092/\": dial tcp [::1]:8092: connect: connection refused"}
5. What I already tried:
I’ve tried understanding how to set logging options to ignore this particular warning but I’m finding it very confusing and haven’t got far with that.
2022/02/15 01:46:45.692 INFO http.handlers.reverse_proxy.health_checker.active HTTP request failed {"host": "localhost:8092", "error": "Get \"http://localhost:8092/\": dial tcp [::1]:8092: connect: connection refused"}
As far as I don’t really have options directly in the Caddyfile to tell it to not care if the localhost:8092 is not there?