You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I expected to be able to host it on a proxy in a couple minutes but this was not the case.
After receiving errors, I expected to be able to check any logs or get a more useful error message.
How to reproduce?
I used "localhost" as domain as any other domain yields the same result
I added Logto to my docker compose:
compose.yml
services:
proxy:
image: jc21/nginx-proxy-manager:2.12.1
restart: unless-stopped
ports:
- '80:80'
- '81:81'
- '443:443'
volumes:
- ./nginx/data:/data
- ./nginx/letsencrypt:/etc/letsencrypt
logto:
image: svhd/logto:1.21.0
depends_on:
postgres:
condition: service_healthy
entrypoint: ["sh", "-c", "npm run cli db seed -- --swe && npm start"]
ports:
- 3001:3001
- 3002:3002
environment:
- TRUST_PROXY_HEADER=1
- DB_URL=postgres://postgres:p0stgr3s@postgres: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.
- ENDPOINT=https://auth.localhost/
- ADMIN_ENDPOINT=https://test.localhost/
postgres:
image: postgres:14-alpine
user: postgres
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: p0stgr3s
healthcheck:
test: ["CMD-SHELL", "pg_isready"]
interval: 10s
timeout: 5s
retries: 5
volumes:
- postgres-data:/var/lib/postgresql/data
volumes:
postgres-data:
I added Logto to the proxy:
Upload SSL certificate on "SSL Certificates" tab by clicking on "Add SSL Certificate" and "custom" (I used self signed for development purposes)
Go to hosts tab "Proxy Hosts"
Click on "Add proxy host"
Enter "auth.localhost" into domain names
Enter the name of the service (logto) as Forward Hostname / IP and the container port as Forward Port
Enable Force SSL on the SSL tab
Click save
Add "test.localhost" the same way you added "auth.localhost"
I think internally Logto uses the URL in ENDPOINT or ADMIN_ENDPOINT for making requests to those URLs from inside the backend.
This works, as long as neither resolve to localhost - I assume in your case auth.localhost and test.localhost both do.
In this case, when Logto makes a request to those hosts the request does not go via nginx-proxy-manager. Logto is trying to make a request (inside its own container) to 127.0.0.1:443 where only 127.0.0.1:3001 and 127.0.0.1:3002 are listening.
You can work around this by adding these hosts as aliases on your nginx-proxy-manager, overriding the DNS resolution and forcing Logto to send those requests via nginx. Add this to your nginx-proxy-manager service in docker-compose.yml:
You may also need to tell Logto to ignore TLS failures, since it won't be aware of the TLS certificate you created. You can add: NODE_TLS_REJECT_UNAUTHORIZED=0 to Logto's environment to do that.
Describe the bug
I was trying to host Logto locally behind a proxy. I used Nginx Proxy Manager to do so. I used the deployment steps in the docs as reference but I could not get it to work successfully.
Expected behavior
I expected to be able to host it on a proxy in a couple minutes but this was not the case.
After receiving errors, I expected to be able to check any logs or get a more useful error message.
How to reproduce?
I used "localhost" as domain as any other domain yields the same result
I added Logto to my docker compose:
compose.yml
I added Logto to the proxy:
Upload SSL certificate on "SSL Certificates" tab by clicking on "Add SSL Certificate" and "custom" (I used self signed for development purposes)
Go to hosts tab "Proxy Hosts"
Click on "Add proxy host"
Enter "auth.localhost" into domain names
Enter the name of the service (logto) as Forward Hostname / IP and the container port as Forward Port
Enable Force SSL on the SSL tab
Click save
Add "test.localhost" the same way you added "auth.localhost"
These were my resulting configs:
Proxy for auth.localhost
Proxy for test.localhost
Registering and logging in was possible on
test.localhost
, but on the dashboard (and any other route) I got error toast "Internal server error."Checking the network debug tools I see that a request to
auth.localhost
is causing it:Manually checking one of the requests, for example the first
https://auth.localhost/api/dashboard/users/total
, results in:(Same result when bypassing the proxy on
http://localhost:3001/api/dashboard/users/total
)I noticed when not defining
ADMIN_ENDPOINT
I get a different error:Now when hitting
https://auth.localhost/api/dashboard/users/total
I get:Which to me is a clear error of what's wrong, but I now I can't go to the admin console to login as I will run into CSP and SSL errors.
I tried the following without success:
If I don't use any proxy at all and don't set any ENDPOINT variable everything works fine as expected.
Here's a log of my docker-compose:
Context
Screenshots
Comment
I'm hoping I made a dumb mistake or maybe shouldn't use Nginx Proxy Manager at all as this service fits perfectly in our ecosystem.
The text was updated successfully, but these errors were encountered: