Return another response without redirecting

1. The problem I’m having:

I need to return the response of from since a redirect seems to be causing issues for some clients.

I tried reverse_proxy { 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:

# Run after apt upgrade caddy
xcaddy build \
  --with \
  --with \
  --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:


ExecStart=/usr/local/bin/caddy run --environ --config /srv/Caddyfile
ExecReload=/usr/local/bin/caddy reload --config /srv/Caddyfile --force


d. My complete Caddy config:

# I excluded the other domains.
# is just a simple reverse_proxy block providing {
  # This one works; mostly. 
  handle /.well-known/lnurlp/ingwie {
    header Access-Control-Allow-Origin *
  # This one does not.
  handle /.well-known/lnurlp/ingwie2 {
    #rewrite * /lnurl
    reverse_proxy * {
      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/
  # Another service
  handle {
    reverse_proxy localhost:8080

5. Links to relevant resources:

The service provided by GitHub - elsirion/clnurl: Playing around with CLN and LNURL

You probably need to set the Host header since you’re proxying over HTTPS reverse_proxy (Caddyfile directive) — Caddy Documentation

Please show that. Enable the debug global option and show your logs. Show what you get from curl -v.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.