Yooooomi / your_spotify

Self hosted Spotify tracking dashboard
GNU General Public License v3.0
2.64k stars 109 forks source link

Can't login using Cloudflare Tunnel #406

Open molotovah opened 1 month ago

molotovah commented 1 month ago

Hi,

I can't login with my spotify account using the following docker compose file : I can reach my webserver but when I clic "login", I get a blank page.

services:
  server:
    container_name: your-spotify-server
    image: yooooomi/your_spotify_server
    depends_on:
      - mongo
    links:
      - mongo
    environment:
      API_ENDPOINT: https://api.spotify.[mydomain]
      CLIENT_ENDPOINT: https://spotify.[mydomain]
      SPOTIFY_PUBLIC: [XXXXXX]
      SPOTIFY_SECRET: [XXXXXX]    
    restart: always

  mongo:
    container_name: your-spotify-mongodb  
    image: mongo:6 
    volumes:
      - ./your_spotify_db:/data/db

  web-client:
    container_name: your-spotify-client  
    image: yooooomi/your_spotify_client
    depends_on:
      - server
    environment:
      API_ENDPOINT: https://spotify.[mydomain]
    restart: always

  server-tunnel:
    container_name: your-spotify-servertunnel  
    image: cloudflare/cloudflared:latest
    depends_on:
      - server
    environment:
      TZ: Europe/Paris
    restart: unless-stopped
    command: tunnel --no-autoupdate run --token [ServerToken (API)]

  web-tunnel:
    container_name: your-spotify-webtunnel
    image: cloudflare/cloudflared:latest
    depends_on:
      - web-client
    environment:
      TZ: Europe/Paris
    restart: unless-stopped
    command: tunnel --no-autoupdate run --token [ClientToken]

In Spotify dev dashboard, my redirect URI are :

I have 2 tunnels in Cloudflare which are up. tunnel

Can anyone help please ?

RagingCactus commented 1 month ago

Your API_ENDPOINT in the frontend is misconfigured. It is currently set to https://spotify.[mydomain], but needs to be https://api.spotify.[mydomain].

404 will be included in the next release, which would show you a specific error page for exactly this misconfiguration. If you want to build the new image yourself, you can try the new error page for yourself.

molotovah commented 1 month ago

Your API_ENDPOINT in the frontend is misconfigured. It is currently set to https://spotify.[mydomain], but needs to be https://api.spotify.[mydomain].

404 will be included in the next release, which would show you a specific error page for exactly this misconfiguration. If you want to build the new image yourself, you can try the new error page for yourself.

Thanks for the answer. I replaced https://spotify.[mydomain] by https://api.spotify.[mydomain] at line 29 but I get the following error SSL_ERROR_NO_CYPHER_OVERLAP while accessing the api URL.

image

Also getting on the dashboard since it can't communicate with the API image

RagingCactus commented 1 month ago

YourSpotify doesn't handle TLS, this is an issue in your Cloudflare setup. I don't use this service and it's not related to YourSpotify, so you're on your own there.

kstehn commented 2 days ago

Well if the tunnel is correctly setup, it should just work. I also use Cloudflare with the cloudflare tunnel.

You need to make sure that you correctly configure the public hostname on the cloudflare page (Zero Trust => Networks => Tunnels => => public hostname). In your case:

This should terminate the https certifacte correctly for you and proxy the request. But you also need to setup the cors enviroment otherwise you get the error with the web application again. I did this like that for the server container CORS=https://spotify.[mydomain],https://api.spotify.[mydomain] But i think it should work when you have setup only https://spotify.[mydomain]