11/**
2- * Shared cache header configurations for API endpoints
2+ * Shared cache and CORS header configurations for API endpoints
33 *
44 * Cache Strategy:
55 * - 5-minute CDN cache (s-max-age=300)
66 * - Stale-while-revalidate for graceful degradation
77 * - CDN-specific headers for Vercel optimization
88 * - No browser cache (CDN-only caching)
9+ *
10+ * CORS Policy:
11+ * - Open access (Access-Control-Allow-Origin: *)
12+ * - Public, read-only API designed for cross-origin consumption
913 */
1014
15+ /**
16+ * CORS headers for cross-origin access
17+ * Enables browser-based clients (dApps, scripts) to consume the API
18+ */
19+ export const corsHeaders = {
20+ "Access-Control-Allow-Origin" : "*" ,
21+ "Access-Control-Allow-Methods" : "GET, OPTIONS" ,
22+ "Access-Control-Allow-Headers" : "Content-Type" ,
23+ }
24+
1125/**
1226 * Standard cache headers for all API endpoints
1327 * - CDN cache: 5 minutes
@@ -26,6 +40,7 @@ export const standardCacheHeaders = {
2640 */
2741export const textPlainHeaders = {
2842 "Content-Type" : "text/plain; charset=utf-8" ,
43+ ...corsHeaders ,
2944 ...standardCacheHeaders ,
3045}
3146
@@ -35,6 +50,7 @@ export const textPlainHeaders = {
3550 */
3651export const jsonHeaders = {
3752 "Content-Type" : "application/json" ,
53+ ...corsHeaders ,
3854 ...standardCacheHeaders ,
3955}
4056
@@ -44,4 +60,5 @@ export const jsonHeaders = {
4460 */
4561export const commonHeaders = {
4662 "Content-Type" : "application/json" ,
63+ ...corsHeaders ,
4764}
0 commit comments