Jump to content

Emby Docker Container behind Traefik | Bad Gateway


Redskyer

Recommended Posts

Hi.

 

In the past I used emby in Windows behind a Traefik Container. Now I had to change everything because I don't want to use Windows anymore. I decided to switch to UnRAID.

Now I've created a Docker Compose File to create my new emby container.

version: '3.7'

networks:
   emby-net:
     driver: bridge
   traefik_traefik-net:
     external: true

services:
   emby:
     container_name: Emby
     image: emby/embyserver:latest
     ports:
       - "8096:8096"
       - "8920:8920"
       - "1900:1900/udp"
     restart: unless-stopped
     devices:
        - /dev/dri:/dev/dri
     environment:
        - UID=18
        - GID=18
        - GIDLIST=18
     volumes:
        - emby-config:/config
        - type: bind
          source: /mnt/user/Downloads
          target: /mnt/Downloads
        - type: bind
          source: /mnt/user/Aufzeichnungen
          target: /mnt/Aufzeichnungen
        - type: bind
          source: /mnt/user/Sicherungen/Musik
          target: /mnt/Musik
        - type: bind
          source: /mnt/user/Sicherungen/Bilder & Videos
          target: /mnt/Bilder & Videos
        - type: bind
          source: /mnt/user/Docker/Zertifikate
          target: /mnt/Zertifikate
        - type: bind
          source: /mnt/user/Backups/Docker/Emby
          target: /mnt/Backup
     networks:
        - emby-net
        - traefik_traefik-net
     labels:
        - "traefik.docker.network=traefik_traefik-net"
        - "traefik.enable=true"
        - "traefik.http.routers.emby.entrypoints=http"
        - "traefik.http.routers.emby.rule=Host(`emby.mydomain.de`)"
        - "traefik.http.routers.emby.middlewares=https-redirect"
        - "traefik.http.routers.emby-s.entrypoints=https"
        - "traefik.http.routers.emby-s.rule=Host(`emby.mydomain.de`)"
        - "traefik.http.routers.emby-s.tls=true"
        - "traefik.http.routers.emby-s.tls.certresolver=letsencrypt"
        - "traefik.http.routers.emby-s.tls.domains[0].main=mydomain.de"
        - "traefik.http.routers.emby-s.tls.domains[0].sans=cloud.mydomain.de,emby.mydomain.de,blog.mydomain.de"
        - "traefik.http.middlewares.https-redirect.redirectscheme.scheme=https"
        - "traefik.http.services.emby-s.loadbalancer.server.port=8920"
        
volumes:
   emby-config:

Now I got the Problem, that emby isn't reachable, if I use my domain name. Its just reachable, when I use the local IP.

I use the emby standard ports for http (8096) and https (8920).

These are the logs from emby:

2020-09-21 17:37:26.559 Error HttpServer: Error in ProcessAccept
	*** Error Report ***
	Version: 4.4.3.0
	Command line: /system/EmbyServer.dll -programdata /config -ffdetect /bin/ffdetect -ffmpeg /bin/ffmpeg -ffprobe /bin/ffprobe -restartexitcode 3
	Operating system: Unix 5.7.8.0
	64-Bit OS: True
	64-Bit Process: True
	User Interactive: True
	Runtime: file:///system/System.Private.CoreLib.dll
	System.Environment.Version: 3.1.2
	Processor count: 4
	Program data path: /config
	Application directory: /system
	System.IO.IOException: System.IO.IOException: The handshake failed due to an unexpected packet format.
	   at System.Net.Security.SslStream.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
	   at System.Net.Security.SslStream.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
	   at System.Net.Security.SslStream.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)
	   at System.Net.Security.SslStream.ProcessAuthentication(LazyAsyncResult lazyResult, CancellationToken cancellationToken)
	   at System.Net.Security.SslStream.BeginAuthenticateAsServer(SslServerAuthenticationOptions sslServerAuthenticationOptions, CancellationToken cancellationToken, AsyncCallback asyncCallback, Object asyncState)
	   at System.Net.Security.SslStream.BeginAuthenticateAsServer(X509Certificate serverCertificate, Boolean clientCertificateRequired, SslProtocols enabledSslProtocols, Boolean checkCertificateRevocation, AsyncCallback asyncCallback, Object asyncState)
	   at System.Net.Security.SslStream.<>c.<AuthenticateAsServerAsync>b__68_1(X509Certificate arg1, Boolean arg2, SslProtocols arg3, AsyncCallback callback, Object state)
	   at System.Threading.Tasks.TaskFactory`1.FromAsyncImpl[TArg1,TArg2,TArg3](Func`6 beginMethod, Func`2 endFunction, Action`1 endAction, TArg1 arg1, TArg2 arg2, TArg3 arg3, Object state, TaskCreationOptions creationOptions)
	   at System.Threading.Tasks.TaskFactory.FromAsync[TArg1,TArg2,TArg3](Func`6 beginMethod, Action`1 endMethod, TArg1 arg1, TArg2 arg2, TArg3 arg3, Object state, TaskCreationOptions creationOptions)
	   at System.Threading.Tasks.TaskFactory.FromAsync[TArg1,TArg2,TArg3](Func`6 beginMethod, Action`1 endMethod, TArg1 arg1, TArg2 arg2, TArg3 arg3, Object state)
	   at System.Net.Security.SslStream.AuthenticateAsServerAsync(X509Certificate serverCertificate, Boolean clientCertificateRequired, SslProtocols enabledSslProtocols, Boolean checkCertificateRevocation)
	   at SocketHttpListener.Net.HttpConnection.Init()
	   at SocketHttpListener.Net.HttpEndPointListener.ProcessAccept(SocketAsyncEventArgs args)
	Source: System.Net.Security
	TargetSite: Void StartReadFrame(Byte[], Int32, System.Net.AsyncProtocolRequest)
	
2020-09-21 17:37:26.624 Error HttpServer: Error in ProcessAccept
	*** Error Report ***
	Version: 4.4.3.0
	Command line: /system/EmbyServer.dll -programdata /config -ffdetect /bin/ffdetect -ffmpeg /bin/ffmpeg -ffprobe /bin/ffprobe -restartexitcode 3
	Operating system: Unix 5.7.8.0
	64-Bit OS: True
	64-Bit Process: True
	User Interactive: True
	Runtime: file:///system/System.Private.CoreLib.dll
	System.Environment.Version: 3.1.2
	Processor count: 4
	Program data path: /config
	Application directory: /system
	System.IO.IOException: System.IO.IOException: The handshake failed due to an unexpected packet format.
	   at System.Net.Security.SslStream.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
	   at System.Net.Security.SslStream.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
	   at System.Net.Security.SslStream.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)
	   at System.Net.Security.SslStream.ProcessAuthentication(LazyAsyncResult lazyResult, CancellationToken cancellationToken)
	   at System.Net.Security.SslStream.BeginAuthenticateAsServer(SslServerAuthenticationOptions sslServerAuthenticationOptions, CancellationToken cancellationToken, AsyncCallback asyncCallback, Object asyncState)
	   at System.Net.Security.SslStream.BeginAuthenticateAsServer(X509Certificate serverCertificate, Boolean clientCertificateRequired, SslProtocols enabledSslProtocols, Boolean checkCertificateRevocation, AsyncCallback asyncCallback, Object asyncState)
	   at System.Net.Security.SslStream.<>c.<AuthenticateAsServerAsync>b__68_1(X509Certificate arg1, Boolean arg2, SslProtocols arg3, AsyncCallback callback, Object state)
	   at System.Threading.Tasks.TaskFactory`1.FromAsyncImpl[TArg1,TArg2,TArg3](Func`6 beginMethod, Func`2 endFunction, Action`1 endAction, TArg1 arg1, TArg2 arg2, TArg3 arg3, Object state, TaskCreationOptions creationOptions)
	   at System.Threading.Tasks.TaskFactory.FromAsync[TArg1,TArg2,TArg3](Func`6 beginMethod, Action`1 endMethod, TArg1 arg1, TArg2 arg2, TArg3 arg3, Object state, TaskCreationOptions creationOptions)
	   at System.Threading.Tasks.TaskFactory.FromAsync[TArg1,TArg2,TArg3](Func`6 beginMethod, Action`1 endMethod, TArg1 arg1, TArg2 arg2, TArg3 arg3, Object state)
	   at System.Net.Security.SslStream.AuthenticateAsServerAsync(X509Certificate serverCertificate, Boolean clientCertificateRequired, SslProtocols enabledSslProtocols, Boolean checkCertificateRevocation)
	   at SocketHttpListener.Net.HttpConnection.Init()
	   at SocketHttpListener.Net.HttpEndPointListener.ProcessAccept(SocketAsyncEventArgs args)
	Source: System.Net.Security
	TargetSite: Void StartReadFrame(Byte[], Int32, System.Net.AsyncProtocolRequest)
	
2020-09-21 17:37:31.661 Error HttpServer: Error in ProcessAccept
	*** Error Report ***
	Version: 4.4.3.0
	Command line: /system/EmbyServer.dll -programdata /config -ffdetect /bin/ffdetect -ffmpeg /bin/ffmpeg -ffprobe /bin/ffprobe -restartexitcode 3
	Operating system: Unix 5.7.8.0
	64-Bit OS: True
	64-Bit Process: True
	User Interactive: True
	Runtime: file:///system/System.Private.CoreLib.dll
	System.Environment.Version: 3.1.2
	Processor count: 4
	Program data path: /config
	Application directory: /system
	System.IO.IOException: System.IO.IOException: The handshake failed due to an unexpected packet format.
	   at System.Net.Security.SslStream.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
	   at System.Net.Security.SslStream.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
	   at System.Net.Security.SslStream.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)
	   at System.Net.Security.SslStream.ProcessAuthentication(LazyAsyncResult lazyResult, CancellationToken cancellationToken)
	   at System.Net.Security.SslStream.BeginAuthenticateAsServer(SslServerAuthenticationOptions sslServerAuthenticationOptions, CancellationToken cancellationToken, AsyncCallback asyncCallback, Object asyncState)
	   at System.Net.Security.SslStream.BeginAuthenticateAsServer(X509Certificate serverCertificate, Boolean clientCertificateRequired, SslProtocols enabledSslProtocols, Boolean checkCertificateRevocation, AsyncCallback asyncCallback, Object asyncState)
	   at System.Net.Security.SslStream.<>c.<AuthenticateAsServerAsync>b__68_1(X509Certificate arg1, Boolean arg2, SslProtocols arg3, AsyncCallback callback, Object state)
	   at System.Threading.Tasks.TaskFactory`1.FromAsyncImpl[TArg1,TArg2,TArg3](Func`6 beginMethod, Func`2 endFunction, Action`1 endAction, TArg1 arg1, TArg2 arg2, TArg3 arg3, Object state, TaskCreationOptions creationOptions)
	   at System.Threading.Tasks.TaskFactory.FromAsync[TArg1,TArg2,TArg3](Func`6 beginMethod, Action`1 endMethod, TArg1 arg1, TArg2 arg2, TArg3 arg3, Object state, TaskCreationOptions creationOptions)
	   at System.Threading.Tasks.TaskFactory.FromAsync[TArg1,TArg2,TArg3](Func`6 beginMethod, Action`1 endMethod, TArg1 arg1, TArg2 arg2, TArg3 arg3, Object state)
	   at System.Net.Security.SslStream.AuthenticateAsServerAsync(X509Certificate serverCertificate, Boolean clientCertificateRequired, SslProtocols enabledSslProtocols, Boolean checkCertificateRevocation)
	   at SocketHttpListener.Net.HttpConnection.Init()
	   at SocketHttpListener.Net.HttpEndPointListener.ProcessAccept(SocketAsyncEventArgs args)
	Source: System.Net.Security
	TargetSite: Void StartReadFrame(Byte[], Int32, System.Net.AsyncProtocolRequest)
	
2020-09-21 17:37:31.706 Error HttpServer: Error in ProcessAccept
	*** Error Report ***
	Version: 4.4.3.0
	Command line: /system/EmbyServer.dll -programdata /config -ffdetect /bin/ffdetect -ffmpeg /bin/ffmpeg -ffprobe /bin/ffprobe -restartexitcode 3
	Operating system: Unix 5.7.8.0
	64-Bit OS: True
	64-Bit Process: True
	User Interactive: True
	Runtime: file:///system/System.Private.CoreLib.dll
	System.Environment.Version: 3.1.2
	Processor count: 4
	Program data path: /config
	Application directory: /system
	System.IO.IOException: System.IO.IOException: The handshake failed due to an unexpected packet format.
	   at System.Net.Security.SslStream.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
	   at System.Net.Security.SslStream.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
	   at System.Net.Security.SslStream.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)
	   at System.Net.Security.SslStream.ProcessAuthentication(LazyAsyncResult lazyResult, CancellationToken cancellationToken)
	   at System.Net.Security.SslStream.BeginAuthenticateAsServer(SslServerAuthenticationOptions sslServerAuthenticationOptions, CancellationToken cancellationToken, AsyncCallback asyncCallback, Object asyncState)
	   at System.Net.Security.SslStream.BeginAuthenticateAsServer(X509Certificate serverCertificate, Boolean clientCertificateRequired, SslProtocols enabledSslProtocols, Boolean checkCertificateRevocation, AsyncCallback asyncCallback, Object asyncState)
	   at System.Net.Security.SslStream.<>c.<AuthenticateAsServerAsync>b__68_1(X509Certificate arg1, Boolean arg2, SslProtocols arg3, AsyncCallback callback, Object state)
	   at System.Threading.Tasks.TaskFactory`1.FromAsyncImpl[TArg1,TArg2,TArg3](Func`6 beginMethod, Func`2 endFunction, Action`1 endAction, TArg1 arg1, TArg2 arg2, TArg3 arg3, Object state, TaskCreationOptions creationOptions)
	   at System.Threading.Tasks.TaskFactory.FromAsync[TArg1,TArg2,TArg3](Func`6 beginMethod, Action`1 endMethod, TArg1 arg1, TArg2 arg2, TArg3 arg3, Object state, TaskCreationOptions creationOptions)
	   at System.Threading.Tasks.TaskFactory.FromAsync[TArg1,TArg2,TArg3](Func`6 beginMethod, Action`1 endMethod, TArg1 arg1, TArg2 arg2, TArg3 arg3, Object state)
	   at System.Net.Security.SslStream.AuthenticateAsServerAsync(X509Certificate serverCertificate, Boolean clientCertificateRequired, SslProtocols enabledSslProtocols, Boolean checkCertificateRevocation)
	   at SocketHttpListener.Net.HttpConnection.Init()
	   at SocketHttpListener.Net.HttpEndPointListener.ProcessAccept(SocketAsyncEventArgs args)
	Source: System.Net.Security
	TargetSite: Void StartReadFrame(Byte[], Int32, System.Net.AsyncProtocolRequest)

and from Traefik:

[21/Sep/2020:17:37:26 +0000] "GET / HTTP/2.0" 502 11 "-" "-" 10952 "emby-s@docker" "http://172.21.0.3:8920" 4ms
[21/Sep/2020:17:37:26 +0000] "GET /favicon.ico HTTP/2.0" 499 21 "-" "-" 10953 "emby-s@docker" "http://172.21.0.3:8920" 1ms
[21/Sep/2020:17:37:31 +0000] "GET / HTTP/2.0" 502 11 "-" "-" 10955 "emby-s@docker" "http://172.21.0.3:8920" 10ms
[21/Sep/2020:17:37:31 +0000] "GET /favicon.ico HTTP/2.0" 502 11 "-" "-" 10956 "emby-s@docker" "http://172.21.0.3:8920" 3ms

 

The IP 172.21.0.3 is used by emby in the traefik_traefik-net.

 

Any Ideas what the problem could be? I use the same configuration for nextcloud and a wordpress blog without any problems.

 

Thanks in advance!

Link to comment
Share on other sites

I have found the problem.

As you can see in the logs of Traefik, that the traffic is redirected to http://172.21.0.3:8920 instead of https://172.31.0.3:8920. Thats the reason why emby rejected the connection. After I changed the destinationport to 8096, everything is working like expected.

The perfect solution would be, if I could redirect the traffik directly to https://172.21.0.3:8920, but I don't know how to do that.

Anyway, I can live with that method.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...