lago icon indicating copy to clipboard operation
lago copied to clipboard

[BUG]: Current configuration doesn't work with API subdomain

Open sercanov opened this issue 2 years ago • 1 comments

Describe the bug First of all, I don't have much Docker experience. I use Dokku for this sort of things. I'm trying to run it directly on AWS EC2 instance, similar to production setup with subdomains like; https://lago.example.com and https://lago-api.example.com

Added to .env and forwarded subdomain CNAME's to EC2 Public IPv4 DNS

LAGO_FRONT_URL=https://lago.example.com
LAGO_API_URL=https://lago-api.example.com

lago-front works fine with HTTPS and self-signed certificates installed but lago-api doesn't seem to have a nginx/domain configuration. I can't assign a subdomain to it. I also tried to clone frontend ports and volume configuration to API but then it throws port 443 is already in use error.

image

To Reproduce Steps to reproduce the behavior:

  1. Set Front Domain
  2. Set Backend Domain

Expected behavior API should serve on LAGO_API_URL

Screenshots

image image

Support

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Additional context Add any other context about the problem here.

sercanov avatar Feb 14 '23 23:02 sercanov

Hello @sercanov

The nginx configuration is only for the front end, not for the back end! Environment variables are just declarative for each app to know where to find the defined service, it's not used to serve the services on a custom domain.

For your need, you should use a reverse proxy (ei: Traefik) to serve the API and FRONT on a custom domain, you can take a look on how we use it for our local development environment here : https://github.com/getlago/lago/wiki/Development-Environment.

jdenquin avatar Feb 15 '23 10:02 jdenquin

Alright @jdenquin thanks, I'm playing with Traefik. I'm not familiar with it. Will comment when it works. It may be helpful to add to docs as production config because people will have an API subdomain in the end.

sercanov avatar Feb 17 '23 10:02 sercanov

Different subdomains with Cloudflare origin certificate was troubled so I've used lago.example.com and lago.example.com/api structure. It works with LetsEncrypt and Nginx, without Traefik now.

sercanov avatar Feb 22 '23 07:02 sercanov