Add FRONTEND_URL-based CORS for production deployment #620

Open
pook wants to merge 59 commits from agent-task/612 into main
Owner

Summary

  • Replace ALLOWED_ORIGINS env var with FRONTEND_URL for single-origin CORS configuration
  • Block API startup in production (NODE_ENV=production) if FRONTEND_URL is not set
  • Update allowed CORS methods to GET, POST, PUT, DELETE, OPTIONS (removed PATCH)
  • Update .env.sample to reflect new FRONTEND_URL variable

Test plan

  • 16/16 unit tests pass (CORS + env validation)
  • TypeScript type-check passes (tsc --noEmit)
  • CORS test: correct origin allowed, wrong origin rejected
  • CORS test: empty allowlist fail-closed (all origins blocked)
  • Env test: missing FRONTEND_URL in production validation fails
  • Env test: FRONTEND_URL set in production passes
  • Env test: FRONTEND_URL not required outside production passes

🤖 Generated with Claude Code

## Summary - Replace `ALLOWED_ORIGINS` env var with `FRONTEND_URL` for single-origin CORS configuration - Block API startup in production (`NODE_ENV=production`) if `FRONTEND_URL` is not set - Update allowed CORS methods to `GET, POST, PUT, DELETE, OPTIONS` (removed `PATCH`) - Update `.env.sample` to reflect new `FRONTEND_URL` variable ## Test plan - [x] 16/16 unit tests pass (CORS + env validation) - [x] TypeScript type-check passes (`tsc --noEmit`) - [x] CORS test: correct origin allowed, wrong origin rejected - [x] CORS test: empty allowlist fail-closed (all origins blocked) - [x] Env test: missing `FRONTEND_URL` in production validation fails - [x] Env test: `FRONTEND_URL` set in production passes - [x] Env test: `FRONTEND_URL` not required outside production passes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Add FRONTEND_URL-based CORS configuration for production deployment
Some checks are pending
CI Quality Gate / Lint / Typecheck / Test / Build (pull_request) Waiting to run
c1b1480125
Replace ALLOWED_ORIGINS with FRONTEND_URL env var for single-origin CORS.
Block startup in production if FRONTEND_URL is missing. Update allowed
methods to GET, POST, PUT, DELETE, OPTIONS (remove PATCH).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
feat: issue #612 add-cors-configuration-for-frontend-to-a (agent task liancebot612)
Some checks failed
CI Quality Gate / Lint / Typecheck / Test / Build (pull_request) Has been cancelled
950cb0ad17
Some checks failed
CI Quality Gate / Lint / Typecheck / Test / Build (pull_request) Has been cancelled
This pull request has changes conflicting with the target branch.
  • .forgejo/workflows/ci.yml
  • bun.lock
  • package.json
  • packages/api/src/db/schema.ts
  • packages/api/src/index.ts
  • packages/api/src/middleware/csrf.ts
  • packages/api/src/middleware/rate-limit.ts
  • packages/api/src/middleware/security-headers.ts
  • packages/api/src/routes/admin.ts
  • packages/api/src/routes/billing.ts
  • packages/api/src/routes/generate-tos.ts
  • packages/api/src/routes/generate.ts
  • packages/api/src/routes/health.ts
  • packages/api/src/routes/questionnaire.ts
  • packages/api/src/services/document-generator.ts
  • packages/api/src/services/llm.ts
  • packages/api/src/templates/index.ts
  • packages/api/tsconfig.json
  • packages/shared/src/types.ts
  • packages/web/src/app/questionnaire/page.tsx
  • packages/web/src/components/documents/DocumentList.tsx
  • packages/web/src/components/questionnaire/ReviewStep.tsx
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin agent-task/612:agent-task/612
git switch agent-task/612
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pook/compliancebot!620
No description provided.