Webcam subdirectory only works on LAN

1. The problem I’m having:

I have Caddy setup to host some websites locally. If I type it works and loads correctly. Mainsail is an app to interface with a 3D Printer. So, I have a webcam that I can use to look at my print to make sure nothing has failed so far. That works when I am on LAN. I connected my network/dns through a VPN (Tailscale) and I can still access Mainsail but the cam doesn’t work. I assume I need to somehow serve the webcam. So, I found that the actual URL for the webcam is and I tried accessing that directly. I can confirm that when I am on LAN, that shows the webcam, but if I am going through the VPN, that URL loads nothing.

I assumed that it was a VPN issue, but the fact that it loads the rest of the page means that DNS is working, communicating with LAN devices (DNS, Caddy, and the Mainsail Raspberry Pi), and caddy since it’s accessible through https with a cert. So, my assumption is that I just need to serve /webcam/webrtc through Caddy. I looked at the documentation and it seemed to be more about files and the keyword was rewrite. So, I don’t think that would really apply here. Any advice would be greatly appreciated!

2. Error messages and/or full log output:

There are no logs that have anything to do with mainsail.

3. Caddy version:

4. How I installed and ran Caddy:

a. System environment:

OS: Proxmox VE 7.4-17 x86_64
Host: 10MUS35500 ThinkCentre M910q
Kernel: 5.15.131-1-pve
Docker version 24.0.7, build afdd53b
Docker Compose version v2.21.0

b. Command:

docker compose up --force-recreate --build -d

c. Service/unit/compose file:


FROM caddy:2.7-builder AS builder

RUN xcaddy build --with

FROM caddy:2.7

COPY --from=builder /usr/bin/caddy /usr/bin/caddy
version: "3"
      context: .
      dockerfile: Dockerfile
    container_name: caddy
    restart: always
      - 80:80
      - 443:443
      - 2019:2019
      - ./config:/config
      - ./data:/data
      - ./logs/:/logs/
      - ./Caddyfile:/etc/caddy/Caddyfile
      - ./sites/:/etc/caddy/sites/
      - web

    external: true

d. My complete Caddy config:, *, * {
        tls {
                dns cloudflare CLOUDFLARE-API-KEY
        respond "go away!"

import sites/*.caddy

sites/3d-printer.caddy {

5. Links to relevant resources:

I figured out that this was a networking issue. I had the raspberry pi running Klipper on my IoT VLAN but my VPN only gave access to my default VLAN.