Hello everyone,
1. Caddy version (caddy version
):
v2.1.1
2. How I run Caddy:
The piece of Caddy file where it is not working :
MYDOMAIN.net
{
handle /admin {
reverse_proxy http://127.0.0.1:81
}
}
a. System environment:
DietPi on Raspberry Pi 3B
I use Caddy only for reverse proxy.
First entry works to a Rocket.Chat installed locally.
The second one which is not working is the /admin which goes to a lighttpd with PiHole (working on port TCP/81)
b. Command:
Caddy works as a service. After I modify the Caddyfile in /etc/caddy/ I reload with
systemctl reload caddy
c. Service/unit/compose file:
systemctl status caddy.service
â—Ź caddy.service - Caddy
Loaded: loaded (/lib/systemd/system/caddy.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2020-09-04 09:55:33 CEST; 1 day 2h ago
Docs: https://caddyserver.com/docs/
Process: 5014 ExecReload=/usr/bin/caddy reload --config /etc/caddy/Caddyfile (code=exited, status=0/SUCCESS)
Main PID: 6851 (caddy)
Tasks: 10 (limit: 2184)
CGroup: /system.slice/caddy.service
└─6851 /usr/bin/caddy run --environ --config /etc/caddy/Caddyfile
d. My complete Caddyfile or JSON config:
more /etc/caddy/Caddyfile
{
# email to use on Let's Encrypt
email mymail@blabla.com
# Uncomment for debug
#acme_ca https://acme-staging-v02.api.letsencrypt.org/directory
#debug
}
# Add gzip compression to requests
(webconf) {
encode gzip
}
# Add forward headers to requests
(theheaders) {
header_up X-Forwarded-Ssl on
header_up Host {host}
header_up X-Real-IP {remote}
header_up X-Forwarded-For {remote}
header_up X-Forwarded-Port {server_port}
header_up X-Forwarded-Proto {scheme}
header_up X-Url-Scheme {scheme}
header_up X-Forwarded-Host {host}
}
WORKING_DOMAIN.net
{
reverse_proxy localhost:3000 {
import theheaders
}
import webconf
}
NOT_WORKING_DOMAIN.net
{
handle /admin {
reverse_proxy http://127.0.0.1:81
}
}
3. The problem I’m having:
When I go to NOT_WORKING_DOMAIN.net in my browser I have a blank file (whatever browser I use).
4. Error messages and/or full log output:
In the Network debugger of Firefox I can see the first request is OK :
GET https://not-working-domain.net/
État 200 OK
Version HTTP/2
Second request has a 502 Bad gateway error :
GET
scheme https
host not-working-domain.net filename|/favicon.ico
État 502 Bad Gateway
Version HTTP/2
5. What I already tried:
I tried several changes in Caddyfile but same issue with the /admin
6. Links to relevant resources:
Well I read the forum and the docs of Caddy website
I wonder if the issue can be due to the fact that the request is done with HTTP/2 request and I know for sure the lighttpd webserver does not support it yet. Hence the title of the thread : Do you know I if it possible for Caddy to change the protocol the HTTP/1.1 for specific requests? (Or maybe I am just wrong in my conf and understanding on how to achieve that).
Thanks!
K