ampache / ampache-docker

Ampache docker package
http://ampache.org
96 stars 69 forks source link

Ampache, Caddy Proxy and SubsonicAPI-based App don't work #128

Open chilcano opened 2 months ago

chilcano commented 2 months ago

Hi there. I've deployed ampache and caddy using docker compose successfully. Ampache works from its Web UI, however It doesn't work when trying to play/stream through any Subsonic API-based Android App. I only can browse songs, albums, etc.

My config is:

  1. Ampache Docker Compose: I've used the same docker-compose.yml available in this repo.
  2. Caddyfile

    
    {
    http_port 8080
    https_port 8443
    
    log {
    output file /logs/caddy.log
    }
    }

*.my-fqdn:8443 { log tls { dns duckdns {env.DNS_PROVIDER_TOKEN} }

@ampache host ampache.my-fqdn handle @ampache { reverse_proxy ampache:80 } }


3. SubsonicAPI app tested:
* Substream - I can browse songs but I can not play/stream. Not error. 
* Ultrasonic - I can browse songs but I can not play/stream because when clicking in **play**, It stands in "buffering" and doesn't stop.

![ultrasonic-buffering](https://github.com/user-attachments/assets/51dce1b2-6869-40d0-84e2-d388247e7ea3)

**I've tried next changes without success:**

1. Update the `Caddyfile`:

{ http_port 8080 https_port 8443

log { output file /logs/caddy.log } }

*.my-fqdn:8443 { log tls { dns duckdns {env.DNS_PROVIDER_TOKEN} }

@ampache host ampache.my-fqdn handle @ampache {

Rewrite rules for Subsonic backend

@rest path_regexp rest ^/rest/(.*).view$
rewrite @rest /rest/index.php?action={re.rest.1}
@rest-fake path_regexp rest-fake ^/rest/fake/(.+)$
rewrite @rest-fake /play/{re.rest-fake.1}
# Rewrite rule for Channels
@channel path_regexp channel ^/channel/([0-9]+)/(.*)$
rewrite @channel /channel/index.php?channel={re.channel.1}&target={re.channel.2}
reverse_proxy ampache:80

} }


3. Change the Ampache configuration using Ampache Web UI:
* `Preferences > Options > Subsonic > Force Subsonic streams to download` from `Off` to `On`.
* `Preferences > Streaming > Enable URL Rewriting` from `Off` to `On`.
* `Preferences > Streaming > Use an alternative playback action for streaming if you have issues with playing music` from `Off` to `On`.

Also I've added my existing `Navidrome` proxied by the same Caddy Proxy to `Ultrasonic` app, I've disabled `Jukebox by Default` in `Ultrasonic` configuration and `Ultrasonic` app has worked smoothly.

I don't know what else to try. I appreciate your support and ideas on this.

Regards.
chilcano commented 1 month ago

Changing from local_web_path="https://ampache.my-fqdn:80" to local_web_path="http://localhost" in ampache/config/ampache.cfg.php fixed the problem. Once changed I restarted the Ampache service running in docker: docker compose restart ampache

You can see the current value of local_web_path through WebUI > Admin > Server Config > Ampache Debug.

The ampache.cfg.php includes information about running it behind of proxy and here as well: https://github.com/ampache/ampache-docker?tab=readme-ov-file#set-the-local_web_path

Hope this helps.