coolify icon indicating copy to clipboard operation
coolify copied to clipboard

[Bug]: Safari video streaming compatibility issues with Coolify's proxy configuration

Open jere-co opened this issue 10 months ago • 3 comments

Error Message and Logs

Problem

Videos served through Coolify's Traefik proxy configuration do not play correctly in Safari browsers. This affects all services that serve video content, including:

  • MinIO/S3 storage
  • Next.js applications with videos in public directories
  • Probably any other service hosting video content

This appears to be due to improper handling of HTTP headers required for proper video streaming.

Technical Details

Safari requires specific HTTP headers for proper video streaming:

  • Accept-Ranges: bytes header must be present
  • Content should not be compressed with gzip/zstd for video files
  • Proper range request handling is needed

The current auto-generated proxy configuration in Coolify applies compression to all content types and doesn't ensure the Accept-Ranges header is present for media files.

Observed Headers

When requesting video content, the following problematic headers are observed:

content-encoding: gzip
# Missing Accept-Ranges: bytes header

Expected Behavior

Videos should play correctly in all browsers, including Safari.

Suggested Fix

Modify the proxy configuration to:

  1. Disable compression for common video file extensions (.mp4, .webm, .mov, etc.)
  2. Add Accept-Ranges: bytes header for video content
  3. Properly handle range requests

This could be implemented by:

  • Adding configuration options in the Coolify UI for handling media content
  • Creating specific middleware rules for common media file extensions
  • Allowing users to add custom headers per content type or path
  • Providing an intuitive way to modify proxy behavior for specific file types

Environment

  • Coolify version: 4.0.0-beta.395
  • Browser: Safari (all versions)
  • Affected configurations: Any service serving video content through Coolify

Impact

This issue prevents proper video playback on approximately 15-20% of all browsers (Safari desktop and mobile), significantly impacting user experience for sites that include video content.

Steps to Reproduce

  1. Deploy any service on Coolify that serves video files
  2. Request an MP4 video file
  3. Try to play the video in Safari browser
  4. Video fails to play or plays incorrectly

Example Repository URL

No response

Coolify Version

4.0.0-beta.395

Are you using Coolify Cloud?

Yes (Coolify Cloud)

Operating System and Version (self-hosted)

No response

Additional Information

No response

jere-co avatar Feb 25 '25 14:02 jere-co

I'll add some more info onto this:

This does not only affect safari, while safari refuses to play the file completely it also affects other browsers like Chrome and Firefox when it comes to "seeking" a file. Because the Accept-Ranges header is missing it will not allow you to seek a file at all.

I'm unsure if there is some header stripping going on because I do run caddy v2 as a proxy inside the docker-compose file to tie together a few things and then expose a directory with file_server and this is then proxied through Coolifys Traefik to the outside world. I know that caddy v2 sets the correct headers for file serving and video file serving, but it seems once everything goes through Traefik those are just missing.

iCrawl avatar May 26 '25 15:05 iCrawl

Is there any workaround for this bug?

ebulku avatar Jun 02 '25 23:06 ebulku

Is there any workaround for this bug?

I started serving the videos from Cloudflare

haltakov avatar Jun 03 '25 07:06 haltakov

Is there any update on this?

ebulku avatar Nov 19 '25 01:11 ebulku