cors-deployment
БесплатноБез исполняемых скриптовНе проверенThe deployment's allowed-origins list (CORS_ORIGINS, built by buildCorsOrigins) across the CDK PlatformStack, GitHub Actions workflows, and Python backends…
от Boise-State-Development★ 22 звезды на GitHubОб этом скилле
Allowed origins (CORS_ORIGINS)
What it is for now
The deployed SPA calls app-api same-origin: appApiUrl: '/api' in
environment.development.ts / environment.production.ts, routed by
CloudFront's /api/* behavior to the app-api ALB. Same-origin is what lets the
BFF Token Handler's __Host- session cookies work, and it means the browser
never makes a cross-origin call to app-api in a deployed environment. It never
calls the AgentCore Runtime at all: app-api proxies chat to it
(apis/app_api/chat/proxy_routes.py).
So the list is less about CORS than its name suggests. It has four live jobs:
| Job | Where | Breaks without it |
|---|---|---|
| S3 bucket CORS for presigned uploads straight from the browser | constructs/data/file-upload-construct.ts, constructs/rag/rag-data-construct.ts (+ spa/rag-cors-updater-construct.ts), constructs/fine-tuning/fine-tuning-data-construct.ts |
Uploads fail in the browser with a CORS error |
Local dev: ng serve on :4200 calls http://localhost:8000 (environment.ts), a real cross-origin request |
CORSMiddleware in apis/app_api/main.py |
Every local request fails preflight |
| Origin allowlists that reuse the variable | voice WebSocket origin check (apis/app_api/voice/routes.py), OAuth2CallbackUrl validation (apis/shared/middleware/agentcore_context.py), the SKIP_AUTH guard in apis/app_api/main.py |
Voice and MCP OAuth consent reject legitimate origins; the guard against SKIP_AUTH on a non-local deployment loses its input |
CORSMiddleware on app-api and inference-api in deployed environments |
apis/app_api/main.py, apis/inference_api/main.py |
Nothing today — no browser calls them cross-origin. Harmless; keep it for local dev and for any future cross-origin client |
Do not remove or empty CORS_ORIGINS as "CORS cleanup after the BFF move": the
allowlists in the third row depend on it.
How the list is built
CDK_DOMAIN_NAME→ always applied ashttps://{value}, firstCDK_CORS_ORIGINS→ additional global origins (optional, comma-separated)- Per-section
CDK_*_CORS_ORIGINS→ extras for one construct (optional)
localhost is never auto-included. Use CDK_CORS_ORIGINS=http://localhost:4200
for an environment local dev must reach.
CDK_DOMAIN_NAME → domainName → "https://{domainName}" (always first)
CDK_CORS_ORIGINS → extraCorsOrigins (appended)
Result: config.corsOrigins = "https://{domainName},{extras}"
Every consumer calls buildCorsOrigins(config, additionalOrigins?) from
infrastructure/lib/config.ts, which splits, deduplicates and appends the
section extras:
// Container env var (Fargate / AgentCore Runtime)
CORS_ORIGINS: buildCorsOrigins(config, config.appApi.additionalCorsOrigins).join(','),
// S3 bucket CORS rule
cors: [{ allowedOrigins: buildCorsOrigins(config, config.ragIngestion.additionalCorsOrigins) }]
The Python services read CORS_ORIGINS with no hardcoded fallback: an empty
value allows no origins.
Section extras exist on AppApiConfig, InferenceApiConfig,
RagIngestionConfig and FineTuningConfig. The file-upload bucket takes none
(buildCorsOrigins(config)), and neither does the SPA distribution, which
serves the app rather than calling anything cross-origin.
Workflow requirements
CDK_DOMAIN_NAME and CDK_CORS_ORIGINS go in the job-level env: block,
not workflow-level, because they read vars.*, which needs environment: on
the job (at workflow level they resolve to empty strings). Every workflow that
runs synth or deploy needs:
env:
CDK_DOMAIN_NAME: ${{ vars.CDK_DOMAIN_NAME }}
CDK_CORS_ORIGINS: ${{ vars.CDK_CORS_ORIGINS }}
Adding a consumer
First ask whether the browser really makes a cross-origin request to it. A new
app-api route doesn't: it is same-origin through /api. Something the browser
reaches directly — a new bucket with presigned uploads, a new WebSocket — does.
- Import
buildCorsOriginsfrominfrastructure/lib/config.ts(relative to the construct's folder underlib/constructs/<area>/) - Call
buildCorsOrigins(config, config.mySection.additionalCorsOrigins) - If it needs its own extras: add
additionalCorsOrigins?: stringto the section's config interface and load it inloadConfig()fromCDK_MY_SECTION_CORS_ORIGINS - Add
CDK_DOMAIN_NAMEandCDK_CORS_ORIGINSto the workflow job env - Add a test beside the existing
buildCorsOriginscases ininfrastructure/test/config.test.ts
A new backend origin check reads CORS_ORIGINS at request time, as
_allowed_callback_origins() does, so tests can monkeypatch it.
Common mistakes
- Putting
vars.*in workflow-levelenv: - Hardcoding
http://localhost:4200inbuildCorsOriginsor a Python fallback - Using
config.domainNamedirectly instead ofbuildCorsOrigins() - Setting
corsOriginsincdk.context.json(overrides domain derivation) - Debugging a deployed "CORS error" on an app-api call: in a deplo
Установить cors-deployment в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл cors-deployment?
The deployment's allowed-origins list (CORS_ORIGINS, built by buildCorsOrigins) across the CDK PlatformStack, GitHub Actions workflows, and Python backends — S3 bucket CORS for presigned uploads, local-dev CORS, and the origin allowlists for voice, OAuth callbacks and the SKIP_AUTH guard. Use when modifying allowed origins, adding a construct or check that needs them, debugging a CORS or "origin not allowed" error, considering removing CORS config after the BFF move, or touching any workflow env vars related to CDK_DOMAIN_NAME or CDK_CORS_ORIGINS.
Как установить скилл cors-deployment?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл cors-deployment запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic