1. Caddy version (caddy version
Caddy v2
2. How I run Caddy:
I thought I need both config json and caddyfile, so right now I am using both files. Can someone please enlighten me how can I use only caddyfile, should I delete config.json file?
a. System environment:
I am using Caddy as reverse proxy in front of apache, and my main domain is successfully configured but can’t access custom domains, maybe because caddyfile and config.json confusion!
b. My complete Caddyfile or JSON config:
Caddyfile -
domain {
reverse_proxy 127.0.0.1:8080
}
Config.json
{
"apps": {
"tls": {
"automation": {
"policies": [
{
"issuer": {
"module": "acme",
"email": "email"
},
"on_demand": true
}
],
"on_demand": {
"rate_limit": {
"interval": "5m",
"burst": 100
}
}
}
},
"http": {
"http_port": 80,
"https_port": 443,
"servers": {
"tiendas": {
"listen": [":80", ":443"],
"max_header_bytes": 41943040,
"routes": [
{
"handle": [
{
"handler": "reverse_proxy",
"upstreams": [
{
"dial": "localhost:8080"
}
]
}
],
"terminal": true
}
]
}
}
}
}
}
3. The problem I’m having:
I cannot access my custom domains but my main domain is accessible!
4. Error messages and/or full log output:
When I try to visit custom domain, this is the error
Error code: SSL_ERROR_INTERNAL_ERROR_ALERT
Jun 02 16:53:08 caddy[15524]: {"level":"info","ts":1591116788.7395413,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":""}
Jun 02 16:53:08 caddy[12023]: {"level":"info","ts":1591116788.7419527,"logger":"admin.api","msg":"received request","method":"POST","host":"localhost:2019","uri":"/load","remote_addr":"127.0.0.1:39716","headers":{"AJun 02 16:53:08 caddy[12023]: {"level":"info","ts":1591116788.7425845,"logger":"admin.api","msg":"config is unchanged"}
Jun 02 16:53:08 caddy[12023]: {"level":"info","ts":1591116788.7427702,"logger":"admin.api","msg":"load complete"}
Jun 02 16:53:08 systemd[1]: Reloaded Caddy.
Jun 02 17:02:50 caddy[12023]: 2020/06/02 17:02:50 http: TLS handshake error from 103.61.39.155:47692: no certificate available for 'myip'
Jun 02 17:06:51 caddy[12023]: 2020/06/02 17:06:51 http: TLS handshake error from 195.54.160.135:33716: no certificate available for 'myip'
Jun 02 17:09:27 caddy[12023]: 2020/06/02 17:09:27 http: TLS handshake error from 45.113.249.233:60524: no certificate available for 'custom domain'
5. What I already tried:
I tried using :80,:443 instead of mydomain in caddyfile but caddy throws error while reloading. Should I delete my config.json and use only caddyfile but when I added
tls{
on_demand
}
in my caddyfile, even then it throws error.
Appreciate your help!!