Reverse proxy to socket with exceptions fails

1. Caddy version (caddy version):v2.3.0

2. How I run Caddy:

systemd service, but testing on CLI

a. System environment:

ubuntu 20 focal fossa

b. Command:

systemctl start caddy

d. My complete Caddyfile or JSON config:

# Set this path to your site's directory.
root * /home/diaspora/diaspora/public

# Enable the static file server.
file_server
encode gzip

reverse_proxy localhost:3000


3. The problem I’m having:

I’m trying to convert this older caddy config to the newer version, and am running into issues with the transparent and except functions.

I get the same result whether I run through a tcp port or a unix socket

# absolutely minimal configuration. "Works on my machine"
# adds no-referrer policy for some added privacy.
diaspora.example.com {
  header / {
    Referrer-Policy "no-referrer"
  }
  root /home/diaspora/diaspora/public
  proxy / unix:/home/diaspora/diaspora/tmp/diaspora.sock {
    transparent
    except /assets /uploads
  }
}

When I run this, I get a connection on port 80, but none of my graphics are showing up. I can provide access to the public site so that it can be seen. It does the same thing whether I go through the public URL or the local IP

4. Error messages and/or full log output:

caddy just fails to start.

5. What I already tried:

i’ve tried researching the two comments under proxy, but i’ve been unable to find an answer, hence I"m here

I’ve tried adding the following with no success:

@exclude {
 not path /assets/*
 not path /downloads/*
}

reverse_proxy @exclude localhost:3000 {
}

I’m still getting 404s for my assets/graphics

Your matcher should look more like this:

@except not path /assets* /downloads*
reverse_proxy @except localhost:3000
1 Like

this is the config that worked for me… hopefully it can help you as well:

DOMAIN {
root * /home/diaspora/diaspora/public
file_server

@notStatic {
not path /assets/*
}

reverse_proxy @notStatic 127.0.0.1:3000

}

1 Like

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