500 words
3 minutes
Emby Direct-Link Playback via 302 Redirects

Why This Setup#

I previously wrote about installing and using the cracked version of Emby, where rclone mounts a cloud drive onto the local filesystem and Emby plays from that media library. That approach is not only fiddly to configure — it also eats your server’s bandwidth during playback.

Compared with that, the setup here is simpler and much friendlier to low-spec servers.

What You’ll Need#

  • A server
  • A domain name (optional)
  • A cloud drive

The Big Picture#

Mount your cloud drive with AList, use AutoFilm to walk the AList contents and generate .strm files, point an Emby local media library at them, and finally let Nginx handle the 302 redirects for playback.

Installation#

We’ll use docker-compose. The docker-compose.yml:

services:
embyserver:
image: amilys/embyserver
platform: linux/amd64 # Force the amd64 image (my host is arm64; delete this line if you're on amd64)
container_name: emby-happy
privileged: true
network_mode: bridge
volumes:
- ./config:/config
- ./Movies:/movies:rslave
ports:
- 8096:8096
restart: unless-stopped
alist:
image: xhofe/alist:latest
container_name: alist
volumes:
- ./alist:/opt/alist/data
network_mode: bridge
ports:
- 5244:5244
environment:
- PUID=0
- PGID=0
- UMASK=022
restart: unless-stopped
nginx:
image: nginx:latest
container_name: nginx
network_mode: host
volumes:
- ./nginx/conf.d:/etc/nginx/conf.d
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
- ./nginx/embyCache:/var/cache/nginx/emby
- ./nginx/logs:/var/log/nginx
restart: unless-stopped

At this point Emby is reachable at http://localhost:8096.

Mounting Drives in AList#

Open http://127.0.0.1:5244. The default account is admin; the initial password shows up in docker logs alist.

AList admin panel

You can also set the password manually: docker exec -it alist /bin/bash, then ./alist admin set password.

For mounting, follow the official guides.

If your drive is Aliyun Drive (阿里云盘), see getting an Aliyun Drive TV token to mount it without speed limits.

Things to note down:

  1. The AList address, e.g. http://192.168.2.3:5244
  2. The AList token — in the admin panel, go to 设置 (Settings) -> 其他 (Other) -> 令牌 (Token)
  3. Your AList username and password

Generating Strm Files with AutoFilm#

Akimio521
/
AutoFilm
Waiting for api.github.com...
00K
0K
0K
Waiting...

AutoFilm can be deployed with Docker too, but since I needed to edit its config, I ran it from source.

Terminal window
git clone https://github.com/Akimio521/AutoFilm.git
cd AutoFilm

Model your config/config.yaml on /config/config.example.yaml.

IMPORTANT

AutoFilm threw errors for me out of the box; after patching a few things it ran fine.

Emby Setup#

Drop the .strm files AutoFilm generated into the mapped Movies directory. Then open http://127.0.0.1:8096, go to 媒体库 (Media Libraries) -> 新增媒体库 (Add Media Library), and pick the movies folder.

Nginx Configuration#

Next, download this archive. Inside you’ll find an nginx folder containing the conf.d directory and nginx.conf — the relevant Nginx configuration. Credit for the configs goes to nanako.

Files to edit:

  1. conf.d/constant.js
  2. conf.d/emby.conf (optional — change the reverse-proxy port for Emby)

The comments in those files explain everything, so I won’t repeat it here. Restart Nginx once you’re done.

Usage#

If you didn’t change conf.d/emby.conf, Emby is now reachable at http://127.0.0.1:8091.

Strm files can’t play in the web client yet — use a native client for playback.

Testing#

Browsing#

While browsing, traffic goes through the emby.mihouo.com domain.

alt text

Playback#

During playback, traffic goes through the aliyundrive.cloud domain.

alt text

Summary#

With 302 direct-link playback, your server bandwidth stays free — only the metadata Emby loads while browsing costs any traffic, and playback itself follows the 302 straight to the source. Playback speed improves dramatically too.

Emby Direct-Link Playback via 302 Redirects
https://www.mihouo.com/en/posts/docker/emby-direct-link-playback/
Author
Jia
Published at
2025-04-18
License
CC BY-NC-SA 4.0