# Custom nginx config for the `marketing` service (see docker-compose.yml). # Replaces nginx:alpine's own default.conf entirely — two jobs instead of # the stock image's one: # # 1. Serve bettersightbox-index.html (and assets/) exactly as before. # 2. Proxy POST /contact-lead same-origin to backend-billing:8000, so the # public marketing page can reach backend/billing/contact_lead.py # without a second public domain or any CORS setup — the browser # only ever talks to the domain it's already on. # # `resolver 127.0.0.11` (Docker's embedded DNS) + a variable in proxy_pass # is deliberate, not stylistic: a plain `proxy_pass http://backend-billing:8000/...;` # resolves that hostname once, at nginx config-load time. If this container # starts before backend-billing's DNS entry exists yet (both come up # together under `docker compose up`), nginx would fail that lookup once # and never retry. Routing it through a variable forces nginx to resolve # at *request* time instead, via the resolver directive — by the time any # real request arrives, backend-billing is up. resolver 127.0.0.11 valid=30s; server { listen 80; location / { root /usr/share/nginx/html; index index.html; } location /contact-lead { set $contact_lead_backend backend-billing; proxy_pass http://$contact_lead_backend:8000/contact-lead; proxy_set_header Host $host; } }