mirror of
https://github.com/maillab/cloud-mail.git
synced 2026-04-25 08:16:01 +03:00
[PR #261] [CLOSED] Configure CORS allowlist via environment#1 #259
Labels
No labels
bug
enhancement
enhancement
enhancement
help wanted
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/cloud-mail-maillab#259
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/maillab/cloud-mail/pull/261
Author: @zlylong
Created: 2/9/2026
Status: ❌ Closed
Base:
main← Head:main📝 Commits (3)
0d2b539Configure CORS origins for worker4ce9ec1Merge pull request #1 from zlylong/codex/configure-cors-with-origin-whitelistaf7b999Merge branch 'maillab:main' into main📊 Changes
2 files changed (+58 additions, -2 deletions)
View changed files
📝
mail-worker/src/hono/hono.js(+57 -2)📝
mail-worker/wrangler.toml(+1 -0)📄 Description
Motivation
Make CORS policy explicit and configurable so frontend origin changes can be updated from environment/wrangler config rather than hardcoded *.
Ensure sensible defaults for credentials, request/response headers and to reduce unsafe open CORS settings.
Description
Replace the global cors() call with an env-driven allowlist implementation in mail-worker/src/hono/hono.js that parses c.env values and normalizes origins via normalizeOrigin and parseCorsOrigins functions.
Configure the middleware origin callback to only return an allowed origin from env, and set credentials: false, allowHeaders: ['Authorization', 'Content-Type'], and exposeHeaders: ['Content-Disposition'] in the cors options.
Document a cors_origins example variable in mail-worker/wrangler.toml (commented) so deployers can supply allowed frontend domains (e.g. `[
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.