Reverse Proxy produces unexpected behaviour when respond is added into caddyfile

1. Caddy version (caddy version):


2. How I run Caddy:

a. System environment:

Stock Ubuntu Server - no docker

b. Command:

sudo caddy start

c. Service/unit/compose file:


Paste full file contents here.
Make sure backticks stay on their own lines,
and the post looks nice in the preview pane.

d. My complete Caddyfile or JSON config: {
        tls fullchain.pem privkey.pem 
        reverse_proxy /jellyfin/* localhost:8096
        file_server # Running a file server allows my keys to be taken, hence the domain redaction

3. The problem I’m having:

If file_server is replaced by respond “Hello World!” the subdirectory /jellyfin/ ceases to be a reverse proxy

4. Error messages and/or full log output:

No error messages

5. What I already tried:

Unfortunately nothing - I have no clue where to start

6. Links to relevant resources:


1 Like

Caddy doesn’t run directives in the order you defined in the Caddyfile. The directives are sorted according to this order:

You’ll notice file_server is below reverse_proxy, but respond is above reverse_proxy.

If you need a different order, you can use either handle blocks to implement mutually exclusive routes (only the first matching handle will run) or route to explicitly override the order of the directives in that block.

e.g. {
	tls fullchain.pem privkey.pem

	handle /jellyfin/* {
		reverse_proxy localhost:8096

	handle {
		root * /path/to/root
1 Like

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