1. Caddy version (caddy version
):
2.3.0
2. How I run Caddy:
I have a couple of raspberry pis, one running nextcloud in a snap and one running a Joplin server in a docker container. CAddy is running on the one also running the joplin server. For the moment, I am just trying to get the reverse proxy to Nextcloud working, and I can’t.
a. System environment:
This is 64bit Raspberry OS; caddy is running plain, ie not in any sort of container
Nextcloud is in a snap installation, with apache, which works when contacted directly
b. Command:
caddy run / reload
c. Service/unit/compose file:
paste full file contents here
d. My complete Caddyfile or JSON config:
My caddyfile is
localhost {
respond "Hello, World. I don't believe this but it works"
log
}
unclaimed.space {
route {
reverse_proxy /nextcloud/* https://192.168.178.46:443 {
header_down Strict-Transport-Security "max-age=15552000;"
header_down X-Real-IP {http.request.remote}
header_down X-Forwarded-For {http.request.remote}
}
reverse_proxy /joplin/* localhost:22300
respond "Yes, I do have a certificate, thank you: now go away."
}
log
}
joplin.unclaimed.space {
reverse_proxy localhost:22300
log
}
nextcloud.unclaimed.space {
reverse_proxy http://192.168.178.46:81 {
header_down Strict-Transport-Security "max-age=15552000;"
header_down X-Real-IP {http.request.remote}
header_down X-Forwarded-For {http.request.remote}
}
log {
output file /var/log/caddy.log
format console
}
}
# DO NOT FORGET
#
# to run "caddy reload" after every change
The two unproxied responses work.
The proxy to nextcloud does not.
Neither does the one to joplin, but that has to be a variant of the same problem
3. The problem I’m having:
When I enter https://nextcloud.unclaimed.space
into my browser, I get
This page isn’t workingnextcloud.unclaimed.space redirected you too many times.
Try clearing your cookies.
ERR_TOO_MANY_REDIRECTS
4. Error messages and/or full log output:
output of tail /var/log/caddy.log
1.6157531438012261e+09 info http.log.access.log0 handled request {"request": {"remote_addr": "51.148.129.254:58005", "proto": "HTTP/1.1", "method": "GET", "host": "nextcloud.unclaimed.space:443", "uri": "/status.php", "headers": {"Accept": ["*/*"], "X-Request-Id": ["0b569c5d-011f-4bbb-acbf-d7241f708318"], "Connection": ["Keep-Alive"], "Accept-Encoding": ["gzip, deflate"], "Accept-Language": ["en-GB,*"], "User-Agent": ["Mozilla/5.0 (Windows) mirall/3.1.3stable-Win64 (build 20210218) (Nextcloud)"], "Authorization": ["Basic XXXXXXXXXX
"]}, "tls": {"resumed": false, "version": 772, "cipher_suite": 4867, "proto": "", "proto_mutual": true, "server_name": "nextcloud.unclaimed.space"}}, "common_log": "51.148.129.254 - - [14/Mar/2021:20:19:03 +0000] \"GET /status.php HTTP/1.1\" 301 256", "duration": 0.001007843, "size": 256, "status": 301, "resp_headers": {"Date": ["Sun, 14 Mar 2021 20:19:03 GMT"], "Location": ["https://nextcloud.unclaimed.space:443/status.php"], "Content-Length": ["256"], "Content-Type": ["text/html; charset=iso-8859-1"], "Strict-Transport-Security": ["max-age=15552000;"], "X-Forwarded-For": ["51.148.129.254:58005"], "X-Real-Ip": ["51.148.129.254:58005"], "Server": ["Caddy", "Apache"]}}
╭─pi@Quinn ~
╰─➤
5. What I already tried:
Endless googling for possible answers; adding the header lines you see into the configuration; running nextcloud on different ports; trying with http and without.
I’m sure I’m missing something obvious and stupid but I don’t know what.