logto-io / logto

🧑‍🚀 The better identity infrastructure for developers and the open-source alternative to Auth0.
https://logto.io
Mozilla Public License 2.0
9.01k stars 452 forks source link

bug: Use docker-compose to build and access the public network ip to localhost #6705

Open moseszane168 opened 1 month ago

moseszane168 commented 1 month ago

Describe the bug

I deployed logto through docker-compose on the cloud server. After deployment, I accessed logto through the public IP and redirected directly to 'http://localhost:3010/unknown-session'.

Expected behavior

Normally redirect to ‘http://publicnetworkIP:3011/sign-in’.

How to reproduce?

docker and postgreSQL. docker-compose.yml:

version: "3.8"
services:
  logto:
    restart: always
    depends_on:
      logtoPostgres:
        condition: service_healthy
    image: svhd/logto:1.18.0
    entrypoint: ["sh", "-c", "npm run cli db seed -- --swe && npm start"]
    ports:
      - 3010:3010
      - 3011:3011
    environment:
      - TRUST_PROXY_HEADER=1
      - DB_URL=postgres://postgres:p0stgr3s@logtoPostgres:5432/logto
      # Mandatory for GitPod to map host env to the container, thus GitPod can dynamically configure the public URL of Logto;
      # Or, you can leverage it for local testing.
      - PORT=3010
      - ADMIN_PORT=3011
      - ENDPOINT
      - ADMIN_ENDPOINT
  logtoPostgres:
    restart: always
    image: postgres:14-alpine
    user: root
    volumes:
      - "./.volumes/logto_db:/var/lib/postgresql/data"
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: p0stgr3s
    healthcheck:
      test: ["CMD-SHELL", "pg_isready"]
      interval: 10s
      timeout: 5s
      retries: 5
volumes:
  data:
    driver: local

Context

Screenshots

Docker container: image

Browser Input: image

Redirect directly to this page: image

wangsijie commented 1 month ago

I'll take a look, does it work on the default ports?

moseszane168 commented 1 month ago

I'll take a look, does it work on the default ports?

3011 3010

moseszane168 commented 1 month ago

how's it going?

moseszane168 commented 1 month ago

I'll take a look, does it work on the default ports? yes

wangsijie commented 1 month ago

Hi @moseszane168, I'll take a look soon.

moseszane168 commented 1 month ago

Hi @moseszane168, I'll take a look soon.

okay, thank you.

eehP commented 1 week ago

any news ?