Skip to content

Add production-like local Docker edge stack for docs + API#7

Merged
Logiar merged 2 commits intomainfrom
feat/local-prod-like-compose
Feb 18, 2026
Merged

Add production-like local Docker edge stack for docs + API#7
Logiar merged 2 commits intomainfrom
feat/local-prod-like-compose

Conversation

@Logiar
Copy link
Owner

@Logiar Logiar commented Feb 18, 2026

Summary

  • add a distroless docs container image (web/Dockerfile) with a lightweight static server (web/server.mjs) for Astro build output
  • add a production-like local topology in docker-compose.yml with an edge nginx service routing example.com to docs and api.example.com to the API
  • add docker/nginx/local-edge.conf plus README guidance for hosts mapping and explicitly documented local-dev allowances (localhost:3000, localhost:8080, and /api/* fallback)

Test Plan

  • docker compose config
  • docker compose build docs api
  • docker compose up -d then curl -H 'Host: example.com' http://127.0.0.1/ returns docs HTML
  • docker compose up -d then curl -H 'Host: api.example.com' 'http://127.0.0.1/now?format=iso' returns timestamp
  • CORS preflight check on api.example.com returns 204 with allow-origin header for http://example.com

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 24fc62faed

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 1 to 5
map $http_origin $cors_origin {
default "";
"http://example.com" "http://example.com";
"https://example.com" "https://example.com";
"http://localhost:3000" "http://localhost:3000";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Permit localhost origin for edge-served docs

The CORS map allows http://localhost:3000 but not http://localhost, even though this same file defines a server_name localhost edge route for docs. When users open docs via http://localhost and the UI calls http://api.example.com, the browser sends Origin: http://localhost; that falls through to default "", so Access-Control-Allow-Origin is empty and the request is blocked by CORS. Adding http://localhost to the map avoids breaking the localhost edge workflow.

Useful? React with 👍 / 👎.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in a06c844. Added http://localhost to the CORS origin map so the localhost edge workflow (Host: localhost docs -> api.example.com) returns a valid Access-Control-Allow-Origin header. Also re-ran a preflight check with Origin: http://localhost and it now returns 204 with the expected CORS header.

@Logiar Logiar enabled auto-merge (squash) February 18, 2026 17:23
@Logiar Logiar merged commit 8dbdd21 into main Feb 18, 2026
5 checks passed
@Logiar Logiar deleted the feat/local-prod-like-compose branch February 18, 2026 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant