Caddy redir root *and* reverse_proxy?

1. Caddy version (caddy version):

v2.4.6

2. How I run Caddy:

Docker CE 20.10.10

a. System environment:

Raspberry Pi + docker
Raspbian 10.11

b. Command:

version: "3.7"

services:
  caddy:
    container_name: caddy
    image: caddy
    restart: always
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - /home/pi/Caddyfile:/etc/caddy/Caddyfile
      - caddy_data:/data
      - caddy_config:/config

volumes:
  caddy_data:
    external: true
  caddy_config:

c. Service/unit/compose file:

d. My complete Caddyfile or JSON config:

{
	# Global Options block
	email me@domain.tld
	# acme_ca https://acme-staging-v02.api.letsencrypt.org/directory
}

cal.domain.tld {
	reverse_proxy 192.168.28.20:3000
}

3. The problem I’m having:

I am attempting to use Caddy as a reverse proxy - which is working fine - and also have it redirect requests that hit root (and only root) to a subdir. It seems I can get either one or the other working, but not both?

4. Error messages and/or full log output:

n/a

5. What I already tried:

cal.domain.tld {
	reverse_proxy 192.168.28.20:3000
	redir / /xyz
}

6. Links to relevant resources:

What behaviour are you seeing exactly?

Can you make example requests with curl -v to show what you’re seeing?

Your config should work fine as you wrote it, from what you’ve shared here. There must be something else going on.

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