From 0dcbe18c5414b85799f17596b28765fde9872551 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 2 Jul 2026 02:02:31 -0400 Subject: [PATCH] fix production API and storefront routing Normalize dashboard API base URLs so bare API origins still call /api/v1 endpoints. Reuse the shared dashboard API base on email verification. Update production storefront URL examples to use the root domain and route footer, policy, and workspace storefront paths through Traefik. --- .env.docker.production.example | 5 +++-- .env.docker.production.generated | 2 +- apps/dashboard/src/app/verify-email/page.tsx | 2 +- docker-compose.production.yml | 2 +- docs/DOCKER.md | 1 + production/.env.docker.production.example | 2 +- production/docker-compose.production.yml | 2 +- 7 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.env.docker.production.example b/.env.docker.production.example index d9a9d1e..a6ba282 100644 --- a/.env.docker.production.example +++ b/.env.docker.production.example @@ -49,10 +49,11 @@ NEXT_PUBLIC_API_URL=https://api.rentaldrivego.ma/api/v1 # Required for production builds. Must be an absolute https:// URL with no trailing slash. SITE_ORIGIN=https://rentaldrivego.ma -# Marketplace sits at the domain root (Traefik routes /dashboard and /admin to their apps) +# Marketplace/storefront public routes sit at the domain root. +# Traefik routes /explore, /renter, /sign-in, /footer, and app policy pages to the storefront app. NEXT_PUBLIC_MARKETING_URL=https://rentaldrivego.ma NEXT_PUBLIC_MARKETPLACE_URL=https://rentaldrivego.ma -NEXT_PUBLIC_STOREFRONT_URL=https://rentaldrivego.ma/storefront +NEXT_PUBLIC_STOREFRONT_URL=https://rentaldrivego.ma NEXT_PUBLIC_DASHBOARD_URL=https://rentaldrivego.ma/dashboard NEXT_PUBLIC_ADMIN_URL=https://rentaldrivego.ma/admin NEXT_PUBLIC_HOMEPAGE_URL=https://rentaldrivego.ma diff --git a/.env.docker.production.generated b/.env.docker.production.generated index 8ecfa49..53b04fa 100644 --- a/.env.docker.production.generated +++ b/.env.docker.production.generated @@ -33,7 +33,7 @@ NEXT_PUBLIC_API_URL=https://api.example.com/api/v1 NEXT_PUBLIC_MARKETING_URL=https://example.com NEXT_PUBLIC_MARKETPLACE_URL=https://example.com NEXT_PUBLIC_HOMEPAGE_URL=https://example.com -NEXT_PUBLIC_STOREFRONT_URL=https://example.com/storefront +NEXT_PUBLIC_STOREFRONT_URL=https://example.com NEXT_PUBLIC_DASHBOARD_URL=https://example.com/dashboard NEXT_PUBLIC_ADMIN_URL=https://example.com/admin NEXT_PUBLIC_PUBLIC_SITE_DOMAIN=example.com diff --git a/apps/dashboard/src/app/verify-email/page.tsx b/apps/dashboard/src/app/verify-email/page.tsx index ed3ce8f..99f7912 100644 --- a/apps/dashboard/src/app/verify-email/page.tsx +++ b/apps/dashboard/src/app/verify-email/page.tsx @@ -5,6 +5,7 @@ import { useSearchParams } from 'next/navigation' import Image from 'next/image' import PublicShell from '@/components/layout/PublicShell' import { useDashboardI18n } from '@/components/I18nProvider' +import { API_BASE } from '@/lib/api' export default function VerifyEmailPage() { const { language } = useDashboardI18n() @@ -44,7 +45,6 @@ export default function VerifyEmailPage() { async function verify() { try { - const API_BASE = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:4000/api/v1' const url = `${API_BASE}/auth/employee/verify-email` const res = await fetch(url, { method: 'POST', diff --git a/docker-compose.production.yml b/docker-compose.production.yml index ee5f7a7..5dd4326 100644 --- a/docker-compose.production.yml +++ b/docker-compose.production.yml @@ -215,7 +215,7 @@ services: restart: unless-stopped labels: - traefik.enable=true - - traefik.http.routers.storefront.rule=(Host(`${PUBLIC_SITE_DOMAIN}`) || Host(`www.${PUBLIC_SITE_DOMAIN}`)) && PathPrefix(`/explore`, `/renter`, `/sign-in`) + - traefik.http.routers.storefront.rule=(Host(`${PUBLIC_SITE_DOMAIN}`) || Host(`www.${PUBLIC_SITE_DOMAIN}`)) && PathPrefix(`/explore`, `/renter`, `/sign-in`, `/footer`, `/app-privacy`, `/app-tc`, `/company-workspace`) - traefik.http.routers.storefront.entrypoints=websecure - traefik.http.routers.storefront.tls=true - traefik.http.routers.storefront.tls.certresolver=letsencrypt diff --git a/docs/DOCKER.md b/docs/DOCKER.md index ae0187c..0e99a70 100644 --- a/docs/DOCKER.md +++ b/docs/DOCKER.md @@ -196,6 +196,7 @@ For production image builds, also define these GitLab CI/CD variables with their ```text NEXT_PUBLIC_API_URL=https://api.rentaldrivego.ma/api/v1 NEXT_PUBLIC_MARKETPLACE_URL=https://rentaldrivego.ma +NEXT_PUBLIC_STOREFRONT_URL=https://rentaldrivego.ma NEXT_PUBLIC_DASHBOARD_URL=https://rentaldrivego.ma/dashboard NEXT_PUBLIC_ADMIN_URL=https://rentaldrivego.ma/admin ``` diff --git a/production/.env.docker.production.example b/production/.env.docker.production.example index 2c3327d..fe0584c 100644 --- a/production/.env.docker.production.example +++ b/production/.env.docker.production.example @@ -49,7 +49,7 @@ SITE_ORIGIN=https://rentaldrivego.ma NEXT_PUBLIC_MARKETING_URL=https://rentaldrivego.ma NEXT_PUBLIC_MARKETPLACE_URL=https://rentaldrivego.ma NEXT_PUBLIC_HOMEPAGE_URL=https://rentaldrivego.ma -NEXT_PUBLIC_STOREFRONT_URL=https://rentaldrivego.ma/storefront +NEXT_PUBLIC_STOREFRONT_URL=https://rentaldrivego.ma NEXT_PUBLIC_DASHBOARD_URL=https://rentaldrivego.ma/dashboard NEXT_PUBLIC_ADMIN_URL=https://rentaldrivego.ma/admin NEXT_PUBLIC_PUBLIC_SITE_DOMAIN=rentaldrivego.ma diff --git a/production/docker-compose.production.yml b/production/docker-compose.production.yml index a7111cd..78d5b16 100644 --- a/production/docker-compose.production.yml +++ b/production/docker-compose.production.yml @@ -215,7 +215,7 @@ services: restart: unless-stopped labels: - traefik.enable=true - - traefik.http.routers.storefront.rule=(Host(`${PUBLIC_SITE_DOMAIN}`) || Host(`www.${PUBLIC_SITE_DOMAIN}`)) && (PathPrefix(`/explore`) || PathPrefix(`/renter`) || PathPrefix(`/sign-in`)) + - traefik.http.routers.storefront.rule=(Host(`${PUBLIC_SITE_DOMAIN}`) || Host(`www.${PUBLIC_SITE_DOMAIN}`)) && (PathPrefix(`/explore`) || PathPrefix(`/renter`) || PathPrefix(`/sign-in`) || PathPrefix(`/footer`) || PathPrefix(`/app-privacy`) || PathPrefix(`/app-tc`) || PathPrefix(`/company-workspace`)) - traefik.http.routers.storefront.entrypoints=websecure - traefik.http.routers.storefront.tls=true - traefik.http.routers.storefront.tls.certresolver=letsencrypt