1. The problem I’m having:
I need to return the response of https://zaps.birb.it/lnurl
from https://birb.it/.well-known/lnurlp/ingwie2
since a redirect seems to be causing issues for some clients.
I tried reverse_proxy https://zaps.birb.it { rewrite /lnurl }
, but to no avail.
Each time I do that, I get a 404 error in cURL and the logs show no error - so I suspect that I have misunderstood how reverse_proxy.rewrite
works, or it’s something else.
2. Error messages and/or full log output:
Sadly none.
3. Caddy version:
v2.7.4 h1:J8nisjdOxnYHXlorUKXY75Gr6iBfudfoGhrJ8t7/flI=
I updated this before writing this issue and verified the issue still persists.
4. How I installed and ran Caddy:
I use XCaddy to build the latest version with plugins. Full script:
#!/bin/bash
# Run after apt upgrade caddy
xcaddy build \
--with github.com/gamalan/caddy-tlsredis \
--with github.com/caddy-dns/cloudflare \
--output /usr/local/bin/caddy
a. System environment:
Ubuntu 22.04 LTS, arm64
b. Command:
I use a SystemD unit (systemctl start/stop/reload caddy
) derived from the default one - it just uses a custom path to work with xcaddy.
c. Service/unit/compose file:
[Unit]
Description=Caddy
Documentation=https://caddyserver.com/docs/
After=network.target network-online.target
Requires=network-online.target
[Service]
Type=notify
User=caddy
Group=caddy
ExecStart=/usr/local/bin/caddy run --environ --config /srv/Caddyfile
ExecReload=/usr/local/bin/caddy reload --config /srv/Caddyfile --force
TimeoutStopSec=5s
LimitNOFILE=1048576
LimitNPROC=512
PrivateTmp=true
ProtectSystem=full
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
[Install]
WantedBy=multi-user.target
d. My complete Caddy config:
# I excluded the other domains.
# zaps.birb.it is just a simple reverse_proxy block providing https://github.com/elsirion/clnurl
birb.it {
# This one works; mostly.
handle /.well-known/lnurlp/ingwie {
header Access-Control-Allow-Origin *
redir https://zaps.birb.it/lnurl
}
# This one does not.
handle /.well-known/lnurlp/ingwie2 {
#rewrite * /lnurl
reverse_proxy * https://zaps.birb.it {
rewrite /lnurl
}
}
# Irrelevant, but keeping it here for completion
handle /.well-known/* {
uri strip_prefix /.well-known
header Access-Control-Allow-Origin *
file_server {
root /srv/birb.it/well-known
}
}
# Another service
handle {
reverse_proxy localhost:8080
}
}
5. Links to relevant resources:
The service provided by zaps.birb.it: GitHub - elsirion/clnurl: Playing around with CLN and LNURL