amfoss / amfoss/root

Add dynamic CORS middleware to support Vercel preview domains

Đang mở
#151 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Rust
Star
4
Fork
23
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

When deploying frontend previews on Vercel, each branch or pull request is assigned a unique preview URL (e.g., https://home-git-fork-harshith-2208-develop-amfoss-dev.vercel.app/dashboard).

However, since CORS does not natively support URL wildcards, backend requests from these dynamically generated subdomains fail unless each preview URL is explicitly whitelisted. This breaks API requests during development and review stages.

## Expected Behavior

Requests originating from any Vercel preview domain (i.e. *.vercel.app) should be accepted without needing manual updates to the CORS whitelist.

## Proposed Solution

* Implement a custom CORS middleware in the backend that:
* Dynamically validates incoming Origin headers.
* Uses regex or pattern matching to allow origins that match the Vercel preview URL format:

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.