Jump to content

Issue with Android clients and Traefik reverse proxy


Flintfamily

Recommended Posts

Flintfamily

Okay so I've recently setup Emby behind a reverse proxy with traefik and I'm seeing a very strange issue with Android clients.

Basically, if you try to resume media on an Android client it will restart for a few seconds then freeze, after freezing no other media will play, even from the beginning. Even restarting the app does't work as it has the previous streaming session still loaded, even killing it on the server side doesn't unfreeze it. You just have a spinning circle then eventually stops. The only way I've found to get the app working is to change connection (to mobile for example). Then I can switch back to wifi and it will work again. But try to resume something and the same thing happens.

I've tested on the web player, LG TV and ipad and none of those clients have an issue. I've opened the Emby ports and connected directly with the Android client and the issue is not present. I assumed it was all Android clients but then a friend tried with his phone and said he had no issue (although I wasn't with him so just going with his experience rather than seeing the test myself). I've tested with a Note 10 Lite and S22 and both have the same issue, my friend claimed his S9+ was okay).

I've attached logs with a session trying first web player, then iPad, then LG TV and finally my phone (which failed).

Would love some help on this as I'm completely stumped. Already tried disabling the headers but no change.

embyserver(7).txt

Link to comment
Share on other sites

Hi, what headers did you try disabling? You want to make sure all headers are preserved and passed through to Emby Server.

Link to comment
Share on other sites

Flintfamily

Just removed the emby_traefik_middleware: "" as a test. But no impact and have put it back.

emby_traefik_sso_middleware: ""

emby_traefik_middleware_default: "{{ traefik_default_middleware + ','
                                     + lookup('vars', emby_name + '_traefik_sso_middleware', default=emby_traefik_sso_middleware)
                                  if (lookup('vars', emby_name + '_traefik_sso_middleware', default=emby_traefik_sso_middleware) | length > 0)
                                  else traefik_default_middleware }}"
emby_traefik_middleware_custom: ""
emby_traefik_middleware: "{{ emby_traefik_middleware_default + ','
                             + emby_traefik_middleware_custom
                          if (not emby_traefik_middleware_custom.startswith(',') and emby_traefik_middleware_custom | length > 0)
                          else emby_traefik_middleware_default
                             + emby_traefik_middleware_custom }}"

emby_traefik_certresolver: "{{ traefik_default_certresolver }}"
emby_traefik_enabled: true

 

Link to comment
Share on other sites

I would suggest comparing your traefik options to pir8radios nginx configuration:

Yes it's different reverse proxy software, but you can still learn a lot from it.

Link to comment
Share on other sites

Flintfamily

Already looked at that but to be honest I can't see the parallels.

Is anyone else using a traefik configuration that I can compare?

 

Link to comment
Share on other sites

Bagul

Here is my docker-compose of traefik:

 

version: '2'

services:
  traefik:
    container_name: traefik
    image: traefik:latest
    command:
      # Provider
      # Provider
      - '--providers.docker'
      - '--providers.docker.exposedbydefault=false'
      - '--providers.docker.network=server'
      # Entrypoints
      - '--entrypoints.web.address=:${TRAEFIK_WEB_ENTRYPOINT:-80}'
      - '--entrypoints.web.http.redirections.entrypoint.to=websecure'
      - '--entrypoints.websecure.address=:${TRAEFIK_WEBSECURE_ENTRYPOINT:-443}'
      # Let's Encrypt
      - '--entrypoints.websecure.http.tls.certresolver=myresolver'
      - '--certificatesresolvers.myresolver.acme.email=*****@****.com'
      - '--certificatesresolvers.myresolver.acme.httpchallenge.entrypoint=web'
      - '--certificatesresolvers.myresolver.acme.httpchallenge=true'
      - '--certificatesresolvers.myresolver.acme.storage=acme.json'
      # Logs
      - '--accesslog.filepath=/logs/access.log'
      - '--accesslog.format=json'
      - '--log.filepath=/logs/traefik.log'
      - '--log.format=json'
      - '--log.level=${TRAEFIK_LOG_LEVEL:-ERROR}'
      # Misc
      - '--api.dashboard'
      - '--api.insecure=true'
      - '--entrypoints.websecure.http.middlewares=compress@file${TRAEFIK_PLUGINS:-}'

      - '--global.checknewversion=${TRAEFIK_CHECK_NEW_VERSION:-false}'
      - '--global.sendanonymoususage=${TRAEFIK_SEND_ANONYMOUS_USAGE:-false}'
      - '--pilot.token=********'
      - '--ping'
      - '--providers.file.directory=/dynamic_conf/'
      - '--providers.file.watch=true'
    ports:
      - '80:80'
      - '443:443'
    networks:
      - server
    restart: always
    labels:
      - 'traefik.enable=true'
      - 'traefik.http.routers.traefik.rule=Host(`traefik.${SITE:-localhost}`)'
      - 'traefik.http.routers.traefik.service=api@internal'
      - 'traefik.http.routers.traefik.middlewares=basic_auth@docker'
      # Middleware definitions
      - 'traefik.http.middlewares.basic_auth.basicauth.users=${USERS}'
    volumes:
      - '/var/run/docker.sock:/var/run/docker.sock'
      - '/mnt/user/appdata/traefik/logs:/logs'
      - '/mnt/user/appdata/traefik/dynamic_conf:/dynamic_conf'
      - '/mnt/user/appdata/traefik/acme.json:/acme.json'
      

networks:
  server:
    external: true

And here are the environment variables I have for Emby

- 'traefik.enable=true'
- 'traefik.http.routers.emby.rule=Host(`emby.***.***`)'

I don't have this problem it's very strange.

 

middleware.yml

http:
  middlewares:
    compress:
      compress: {}

 

If Emby is not in a docker container or if it is on the host network I advise you to use Caddy2

 

Edited by Bagul
Link to comment
Share on other sites

Hi Flintfamily.

Couple questions for you. Is it all Android clients having this issue or just a specific Android client or two?  Which Android hardware have you tried with it?

Did you ever have it working correctly or is this just one of the last problems you're aware of since setting it up?
Did you follow a guide you found somewhere? If so can you show us what you used?

Are you using something like emby.yourdomain.ext and not something like yourdomain.ext/emby as part of the url?

12 hours ago, Flintfamily said:

Just removed the emby_traefik_middleware: "" as a test. But no impact and have put it back.

emby_traefik_sso_middleware: ""

emby_traefik_middleware_default: "{{ traefik_default_middleware + ','
                                     + lookup('vars', emby_name + '_traefik_sso_middleware', default=emby_traefik_sso_middleware)
                                  if (lookup('vars', emby_name + '_traefik_sso_middleware', default=emby_traefik_sso_middleware) | length > 0)
                                  else traefik_default_middleware }}"
emby_traefik_middleware_custom: ""
emby_traefik_middleware: "{{ emby_traefik_middleware_default + ','
                             + emby_traefik_middleware_custom
                          if (not emby_traefik_middleware_custom.startswith(',') and emby_traefik_middleware_custom | length > 0)
                          else emby_traefik_middleware_default
                             + emby_traefik_middleware_custom }}"

emby_traefik_certresolver: "{{ traefik_default_certresolver }}"
emby_traefik_enabled: true

 

Do you have more than just this in your config and was just showing us the middleware and cert section?
Otherwise you missing a lot of info that is needed.

@Bagul

Took a quick look at your setup above.  Is it safe to say you're not using any webhooks or sockets with Emby nor Live TV via mp3 files?

Link to comment
Share on other sites

Flintfamily

@cayars that was just a section of the full config, will post it all tomorrow for you to take a look at.

So far I've found it working fine with galaxy s8 and s9 but not note 10 lite or s22.

The only other issue I've identified is with the podcast plugin I can't skip, pods will play from the beginning but when skipped will just return to the current play position. Not tested pods on any other devices yet.

I am using emby.domain.tld not domain.tld/emby

 

  • Like 1
Link to comment
Share on other sites

Flintfamily

I did some editing based on @Bagul's docker compose and it seems the issue is resolved. Initially I could resume but then skipping or manually changing the play position caused the same issue. I restarted the app and tried again and it has no more issue. I've tried a few different times and it appears the app is working fine. So thank you to everyone who chipped in. I will see if it is completely resolved or whether I have any further intermittent issues.

  • Like 1
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...