1. Caddy version (caddy version
):
root@OpenWrt:~/caddy# docker exec -it caddy caddy version
v2.2.1 h1:Q62GWHMtztnvyRU+KPOpw6fNfeCD3SkwH7SfT1Tgt2c=
2. How I run Caddy:
a. System environment:
Docker in OpenWrt
b. Command:
docker run -d \
-p 81:80 -p 444:443 -p 8877:2022 \
-v $PWD/caddy/data:/data \
-v $PWD/caddy/config:/config \
-v $PWD/caddy/Caddyfile:/etc/caddy/Caddyfile \
--name caddy \
caddy
c. Service/unit/compose file:
d. My complete Caddyfile or JSON config:
{
auto_https off
}
:443
{
reverse_proxy /baidu baidu.com
reverse_proxy /je 192.168.2.115:5001
reverse_proxy https://www.baidu.com
log
}
localhost:2022 {
respond "goody"
}
3. The problem I’m having:
I am running Caddy on my router and I want to use a reverse proxy to access the website I deployed on the NAS. But it has not been realized now, I am a novice and I am looking for a solution.
I have deployed multiple sites on the NAS, and I want to achieve unified access through a reverse proxy.
4. Error messages and/or full log output:
The following logs are output through docker logs caddy.
{“level”:“info”,“ts”:1603864285.464823,“logger”:“admin”,“msg”:“admin endpoint started”,“address”:“tcp/localhost:2019”,“enforce_origin”:false,“origins”:[“localhost:2019”,“[::1]:2019”,“127.0.0.1:2019”]}
{“level”:“info”,“ts”:1603864285.4655902,“logger”:“http”,“msg”:“enabling automatic HTTP->HTTPS redirects”,“server_name”:“srv0”}
{“level”:“info”,“ts”:1603864285.4656045,“logger”:“tls.cache.maintenance”,“msg”:“started background certificate maintenance”,“cache”:“0xc0003da7e0”}
{“level”:“info”,“ts”:1603864285.5581527,“logger”:“tls”,“msg”:“setting internal issuer for automation policy that has only internal subjects but no issuer configured”,“subjects”:[“localhost”]}
{“level”:“info”,“ts”:1603864285.562492,“logger”:“tls”,“msg”:“cleaned up storage units”}
{“level”:“info”,“ts”:1603864285.7667906,“logger”:“pki.ca.local”,“msg”:“root certificate is already trusted by system”,“path”:“storage:pki/authorities/local/root.crt”}
{“level”:“info”,“ts”:1603864285.7674365,“logger”:“http”,“msg”:“enabling automatic TLS certificate management”,“domains”:[“localhost”]}
{“level”:“warn”,“ts”:1603864285.7704186,“logger”:“tls”,“msg”:“stapling OCSP”,“error”:“no OCSP stapling for [localhost]: no OCSP server specified in certificate”}
{“level”:“info”,“ts”:1603864285.7707663,“msg”:“autosaved config”,“file”:“/config/caddy/autosave.json”}
{“level”:“info”,“ts”:1603864285.7708268,“msg”:“serving initial configuration”}
{“level”:“info”,“ts”:1603864285.771502,“logger”:“tls.renew”,“msg”:“acquiring lock”,“identifier”:“localhost”}
{“level”:“info”,“ts”:1603864285.772546,“logger”:“tls.renew”,“msg”:“lock acquired”,“identifier”:“localhost”}
{“level”:“info”,“ts”:1603864285.774558,“logger”:“tls.renew”,“msg”:“renewing certificate”,“identifier”:“localhost”,“remaining”:-22625.774541828}
{“level”:“info”,“ts”:1603864285.781381,“logger”:“tls.renew”,“msg”:“certificate renewed successfully”,“identifier”:“localhost”}
{“level”:“info”,“ts”:1603864285.7814324,“logger”:“tls.renew”,“msg”:“releasing lock”,“identifier”:“localhost”}
{“level”:“info”,“ts”:1603864285.781852,“logger”:“tls”,“msg”:“reloading managed certificate”,“identifiers”:[“localhost”]}
{“level”:“warn”,“ts”:1603864285.784492,“logger”:“tls”,“msg”:“stapling OCSP”,“error”:“no OCSP stapling for [localhost]: no OCSP server specified in certificate”}
{“level”:“info”,“ts”:1603864285.7845957,“logger”:“tls.cache”,“msg”:“replaced certificate in cache”,“identifiers”:[“localhost”],“new_expiration”:1603907485}
5. What I already tried:
When I visit on the router.
root@OpenWrt:~/caddy# curl -X POST -i localhost:8877 HTTP/1.0 400 Bad Request Client sent an HTTP request to an HTTPS server.