Zibbp / ganymede

Twitch VOD and Live Stream archiving platform. Includes a rendered and real-time chat for each archive.
https://github.com/Zibbp/ganymede
GNU General Public License v3.0
457 stars 24 forks source link

login issue: Cross-Origin Request Blocked #300

Closed priti921 closed 12 months ago

priti921 commented 1 year ago

Error in console:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://<ip-address>:4800/api/v1/auth/login. (Reason: CORS request did not succeed). Status code: (null).

This is my docker-compose.yaml file:

version: "3.3"
services:
  ganymede-api:
    container_name: ganymede-api
    image: ghcr.io/zibbp/ganymede:latest
    restart: unless-stopped
    environment:
      - TZ=America/Chicago # Set to your timezone
      - DB_HOST=ganymede-db
      - DB_PORT=5432
      - DB_USER=ganymede
      - DB_PASS=PASSWORD
      - DB_NAME=ganymede-prd
      - DB_SSL=disable
      - JWT_SECRET=SECRET
      - JWT_REFRESH_SECRET=SECRET
      - TWITCH_CLIENT_ID=<secret-code>
      - TWITCH_CLIENT_SECRET=<secret-code>
      - FRONTEND_HOST=http://<ip-address>:4801
      # OPTIONAL
      # - OAUTH_PROVIDER_URL=
      # - OAUTH_CLIENT_ID=
      # - OAUTH_CLIENT_SECRET=
      # - OAUTH_REDIRECT_URL=http://IP:PORT/api/v1/auth/oauth/callback # Points to the API service
    volumes:
      - /mount/vod:/vods
      - ./logs:/logs
      - ./data:/data
      # Uncomment below to persist temp files
      #- ./tmp:/tmp
    ports:
      - 4800:4000
  ganymede-frontend:
    container_name: ganymede-frontend
    image: ghcr.io/zibbp/ganymede-frontend:latest
    restart: unless-stopped
    environment:
      - API_URL=http://http://<ip-address>:4800 # Points to the API service
      - CDN_URL=http://http://<ip-address>:4802 # Points to the CDN service
      - SHOW_SSO_LOGIN_BUTTON=true # show/hide SSO login button on login page
      - FORCE_SSO_AUTH=false # force SSO auth for all users (bypasses login page and redirects to SSO)
      - REQUIRE_LOGIN=false # require login to view videos
    ports:
      - 4801:3000
  ganymede-db:
    container_name: ganymede-db
    image: postgres:14
    volumes:
      - ./ganymede-db:/var/lib/postgresql/data
    environment:
      - POSTGRES_PASSWORD=PASSWORD
      - POSTGRES_USER=ganymede
      - POSTGRES_DB=ganymede-prd
    ports:
      - 4803:5432
  ganymede-nginx:
    container_name: ganymede-nginx
    image: nginx
    volumes:
      - /home/priti/ganymede/nginx.conf:/etc/nginx/nginx.conf:ro
      - /mount/vod:/mnt/vods
    ports:
      - 4802:8080

Steps I did:

1.went to the URL: http://ip-address:4801

  1. opened login page
  2. puts in username/pass( admin/ganymede )
  3. no changes seen
  4. in console i get the error: Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://<ip-addgress>:4800/api/v1/auth/login. (Reason: CORS request did not succeed). Status code: (null).

Am I doing something wrong? I'm not used to this much but i tried following the steps in installation. Thanks in advance

Zibbp commented 1 year ago

Looks like your frontend ENV vars have a double http://

      - API_URL=http://http://<ip-address>:4800 # Points to the API service
      - CDN_URL=http://http://<ip-address>:4802 # Points to the CDN service
priti921 commented 1 year ago

Looks like your frontend ENV vars have a double http://

      - API_URL=http://http://<ip-address>:4800 # Points to the API service
      - CDN_URL=http://http://<ip-address>:4802 # Points to the CDN service

Yeah i figured that one out while writing this issue. But i forgot to edit the texts later.

Still it's showing the same cors error

Zibbp commented 1 year ago

I spun up your provide docker compose and I was able to log in just fine. Is there any unique about your Docker networking? Do you have any browser extensions that may be interfering?

priti921 commented 12 months ago

yeah It didn't work on my PC but worked in my laptop so I'm guessing I made some mistake somewhere.

anyways, thank you for helping me out :)