Stream Videos from a Local Server to Chromecast
How to cast media from a Jellyfin server in your home network to a Chromecast device.
Chromecast can only cast from HTTPS URLs, so we need to obtain an SSL certificate. I doubt there is an easy way to install a custom certificate on a Chromecast device, so a self-signed certificate won’t work, it will have to be signed by a trusted Certificate Authority (CA), like Let’s Encrypt.
To get this certificate, you need to have a public domain because CAs won’t sign a certificate for an IP address or a local domain.
But where should this domain point to? You can actually configure it to point to the private IP address where the video server in your home network is hosted.
How will the CA verify that you own the domain? Well, you cannot use the HTTP challenge since they can’t reach your server hosted on your private network. Luckily, there’s a DNS challenge that works by adding a TXT record to the domain’s DNS records.
Here are the steps I followed:
Run Jellyfin on a server in your home network. Let’s say it is running at
192.168.0.99:8096
.Buy a domain name, such as
example.com
, and configure it to point to192.168.0.99
. A subdomain, likemedia.example.com
, will also work.Since the content needs to be served over HTTPS, set up a reverse proxy in front of the Jellyfin server.
I used Caddy because it makes it easy to get a certificate from Let’s Encrypt. Alternatively, you can use Nginx or Apache with Certbot.Configure Caddy to obtain a certificate using a DNS challenge. This requires a DNS provider with an API to update DNS records. I use (and recommend) Porkbun to manage my domains and Caddy has a module for it.
Here’s how my Caddyfile looks like:media.example.com { reverse_proxy localhost:8096 tls { dns porkbun { api_key {env.PORKBUN_API_KEY} api_secret_key {env.PORKBUN_API_SECRET_KEY} } } }
And that’s it! Now you can visit https://media.example.com
and cast videos to your Chromecast device.
Make sure your Chromecast is on the same network as the server, or at least able to reach it.