1. The problem I’m having:
My home networking setup has an IoT VLAN (100) [10.10.10.0/24] as well as a Home LAN [192.168.1.0/24]. I have a single Jellyfin instance running inside a Proxmox LXC that has two interfaces with an IP on each of the above subnets (and correctly configured matching VLAN tag for IoT).
The goal is to have the single address https://jellyfin.example.com
configured within my Google Chromecast, but when the Chromecast switches WiFi connection between the Home WiFi network and the IoT network it will continue to work without additional configuration.
Since I do not have a layer 3 switch, the most important aspect of this setup is that when the Chromecast is on the Home network, it does not attempt to stream from the IoT network (or vice versa), since this will force packets across my 100 MbE router and result in choppy video.
The ideal setup would be to just keep Chromecast on the IoT network always but for various reasons this is not possible.
My criteria for success:
- Have a single instance of Caddy reverse proxy the Jellyfin service via the correct interface.
- I believe the
bind
directive can accomplish this
- I believe the
So before I embark on this project, I am looking for feedback on whether my approach is feasible, based on the Caddyfile configuration pasted below.
Questions I have:
- Does the bind directive attach the matcher to the interface? It’s hard to tell the cause/effect. I believe attempting a connection from the incorrect LAN would just result in no match, and fall through.
- Give above, would I still need to:
- Expose two interfaces to Caddy, same as I’ve done for Jellyfin
- Resolve the address of Caddy using the source IP of the request, which would require some DNSMasq / PiHole configuration
- How likely is it that Chromecast will cache the IP when switching LANs?
It’s ok for my DNS service to run on the Home LAN, but I believe mismatched LANs when resolving Caddy’s address would not work based on the configuration I’ve provided, or result in choppy video if I relaxed the matcher.
2. Error messages and/or full log output:
3. Caddy version:
2.8.4
4. How I installed and ran Caddy:
a. System environment:
b. Command:
rm -rf /usr/local/go && tar -C /usr/local -xzf go1.22.4.linux-amd64.tar.gz
xcaddy build --with github.com/caddy-dns/porkbun
sudo dpkg-divert --divert /usr/bin/caddy.default --rename /usr/bin/caddy
sudo mv ./caddy /usr/bin/caddy.custom
sudo update-alternatives --install /usr/bin/caddy caddy /usr/bin/caddy.default 10
sudo update-alternatives --install /usr/bin/caddy caddy /usr/bin/caddy.custom 50
sudo systemctl restart caddy
c. Service/unit/compose file:
# caddy.service
#
# For using Caddy with a config file.
#
# Make sure the ExecStart and ExecReload commands are correct
# for your installation.
#
# See https://caddyserver.com/docs/install for instructions.
#
# WARNING: This service does not use the --resume flag, so if you
# use the API to make changes, they will be overwritten by the
# Caddyfile next time the service is restarted. If you intend to
# use Caddy's API to configure it, add the --resume flag to the
# `caddy run` command or use the caddy-api.service file instead.
[Unit]
Description=Caddy
Documentation=https://caddyserver.com/docs/
After=network.target network-online.target
Requires=network-online.target
[Service]
Type=notify
User=caddy
Group=caddy
ExecStart=/usr/bin/caddy run --environ --config /etc/caddy/Caddyfile
ExecReload=/usr/bin/caddy reload --config /etc/caddy/Caddyfile --force
TimeoutStopSec=5s
LimitNOFILE=1048576
PrivateTmp=true
ProtectSystem=full
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
[Install]
WantedBy=multi-user.targe
d. My complete Caddy config:
*.example.com, example.com {
@jellyfin_home {
host jellyfin.example.com
client_ip 192.168.1.0/24
}
handle @jellyfin_home {
bind 192.168.1.92
reverse_proxy http://192.168.1.4:8096
}
@jellyfin_iot {
host jellyfin.example.com
client_ip 10.10.10.0/24
}
handle @jellfyin_iot {
bind 10.10.10.100
reverse_proxy http://10.10.10.17:8096
}
}