1. Caddy version (caddy version
):
v2
2. How I run Caddy:
docker compose
a. System environment:
raspbian Bullseye
b. Command:
c. Service/unit/compose file:
caddy:
container_name: caddy
image: caddy:latest
volumes:
- "/home/pi/caddy/Caddyfile:/etc/caddy/Caddyfile"
- "/home/pi/caddy/data:/data"
environment:
- "TZ=Europe/Rome"
restart: always
ports:
- "80:80"
- "443:443"
- "11110:11110"
- "111111:111111"
d. My complete Caddyfile or JSON config:
(https_header) {
header {
Strict-Transport-Security "max-age=31536000; includeSubdomains"
X-XSS-Protection "1; mode=block"
X-Content-Type-Options "nosniff"
X-Frame-Options "SAMEORIGIN"
Referrer-Policy "same-origin"
}
}
https://labahouse.ddns.net {
respond "Saluti da casamia"
file_server
}
https://labahouse.ddns.net:11110 {
import https_header
reverse_proxy http://10.0.0.40:80
}
https://labahouse.ddns.net:11111 {
import https_header
reverse_proxy http://10.0.0.5:80
}
https://labahouse.ddns.net:8123 {
import https_header
reverse_proxy http://10.0.0.5:8123
}
https://labahouse.ddns.net/mv{
import https_header
reverse_proxy http://10.0.0.40:80/cloud
}
3. The problem I’m having:
Hi all
I ask your support because I’m trying - without success - to configure Caddy to reverse proxy the services inside may LAN.
I have a variable ip, so I registered a domain with NoIp.
I can not use the ports to connect to internal servers because from my office laptop all ports are closed, excluded 80 and 443.
I’d like to reach the different services that are (at this moment):
- Nextcloud in server “mv” IP=10.0.0.40
- Nexccloud in server “NUC” IP=10.0.0.5
- Home Assistant in server “NUC” IP=10.0.0.5
in this way:
- https//labahouse.ddns.net/mv ==> http//10.0.0.40/cloud
- https//abahouse.ddns.net/nuc ==> http//10.0.0.5/cloud
- https//labahouse.ddns.net/ha ==> http//10.0.0.5:8123
The only way I found to connect to the two different Nextcloud server is by reversing two ports. If I try using a subfolder caddy’s docker doesn’t start, and I get an error (at the bottom of this page)
- https//labahouse.ddns.net:11111/cloud ==> http//10.0.0.40/cloud
- https//abahouse.ddns.net:11110/cloud ==> http//10.0.0.5/cloud
4. Error messages and/or full log output:
{"level":"error","ts":1642976703.068634,"logger":"http.handlers.reverse_proxy","msg":"aborting
with incomplete response","error":"context canceled"}
{"level":"info","ts":1642977453.4528205,"msg":"shutting down apps, then terminating","signal":
"SIGTERM"}
{"level":"warn","ts":1642977453.4533787,"msg":"exiting; byeee!! ď‘‹","signal":"SIGTERM"}
{"level":"info","ts":1642977454.6018977,"logger":"tls.cache.maintenance","msg":"stopped backgr
ound certificate maintenance","cache":"0x2c0b860"}
{"level":"info","ts":1642977454.6077657,"logger":"admin","msg":"stopped previous server","addr
ess":"tcp/localhost:2019"}
{"level":"info","ts":1642977454.6100597,"msg":"shutdown complete","signal":"SIGTERM","exit_cod
e":0}
{"level":"info","ts":1642977468.9532478,"msg":"using provided configuration","config_file":"/e
tc/caddy/Caddyfile","config_adapter":"caddyfile"}
run: adapting config using caddyfile: parsing caddyfile tokens for 'reverse_proxy': /etc/caddy
/Caddyfile:24 - Error during parsing: for now, URLs for proxy upstreams only support scheme, h
ost, and port components
{"level":"info","ts":1642977489.1823535,"msg":"using provided configuration","config_file":"/e
tc/caddy/Caddyfile","config_adapter":"caddyfile"}
run: adapting config using caddyfile: parsing caddyfile tokens for 'reverse_proxy': /etc/caddy
/Caddyfile:24 - Error during parsing: for now, URLs for proxy upstreams only support scheme, h
ost, and port components