Yooooomi / your_spotify

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

Using y_s behing nginx proxy manager- localhost:8080 error #141

Open tjohnson-2 opened 2 years ago

tjohnson-2 commented 2 years ago

First off, I'm doing all of this through Portainer on a remote, headless server. I've configured the Docker CE script to point to two different URLs: https://spotify... (port 3000) and https://spotifyauth... (port 8080. I've added these ports to Cloudflare as I use that for my DNS. Upon visiting *spotify... and clicking the "Login with Spotify" button, it takes a second to load but then serves the page http://localhost:8080/oauth/spotify. This shouldn't be happening because I've changed all of the references to http://localhost:8080/ to point to https://spotifyauth...

Expected behavior:

Was expecing the home page to load as it does when the exact same config if used, just with all of the localhost URLs instead of the NPM URLs.

Additional context:

services: server: image: yooooomi/your_spotify_server restart: always ports:

Screenshots

https://imgur.com/a/DvpyOLm

Yooooomi commented 2 years ago

Hello! It seems that you inverted variables in your compose file. For the server, you're using spotifyauth as the web application.

schromp commented 2 years ago

Hello, i seem to have the same error. Im hosting everything behind nginx proxy manager. Im constantly getting redirected to localhost:8080 when trying to authenticate myself.

docker-compose:
version: "3"

services:
  server:
    image: yooooomi/your_spotify_server
    restart: always
    links:
      - mongo
    depends_on:
      - mongo
    environment:
      - API_ENDPOINT=http://auth.example.com# This MUST be included as a valid URL in the spotify dashboard (see below)
      - CLIENT_ENDPOINT=http://localhost:3000
      - SPOTIFY_PUBLIC=***
      - SPOTIFY_SECRET=***
      - CORS=http://localhost:3000,http://localhost:3001 # all if you want to allow every origin
  mongo:
    container_name: mongo
    image: mongo:4.4.8
    volumes:
      - ./your_spotify_db:/data/db

  web:
    image: yooooomi/your_spotify_client
    restart: always
    environment:
      - API_ENDPOINT=http://auth.example.com

My Nginx has works with the webservice but not with the localhost:8080 it seems. I redirect the auth.example.com url to http://yourspotify-server-1:8080

Maybe you can help me aswell

Yooooomi commented 2 years ago

You didn't open any port of your container, it might be unreachable.

schromp commented 2 years ago

You didn't open any port of your container, it might be unreachable.

Well thats because i want to have everything behind the proxy with no open ports. Is that not possible or am i just not experienced enough?

Yooooomi commented 2 years ago

Your reverse proxy needs to be able to access your container. Opening a port on our container only allows nginx to access it, it does not open to the web.

lluni commented 2 years ago

I also use nginx proxy manager and it works with my compose file as seen in #143.

The docker network npm_bridge is a custom network to link all the services together that I would like to access with nginx proxy manager to prevent opening ports to the public internet (see: nginx proxy manager docs) and in nginx proxy manager I just proxy sapi.domain.com to http://your_spotify_server_1:8080 and spotify.domain.com to http://your_spotify_web_1:3000 (you obviously need to change the proxy hosts to your (sub-)domains and container names).

schromp commented 2 years ago

Thanks for the help guys, got that part working now. :D