|
@@ -38,8 +38,18 @@ export function getCorsHeaders(requestOrigin?: string, additionalMethods: string
|
|
|
allowOrigin = allowedOrigins[0] || '*';
|
|
allowOrigin = allowedOrigins[0] || '*';
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // Default methods - include PATCH and DELETE for API operations
|
|
|
|
|
- const defaultMethods = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS'];
|
|
|
|
|
|
|
+ // IMPORTANT: Keep all these methods in the list!
|
|
|
|
|
+ // DELETE is required for custom-content-delete and other delete operations.
|
|
|
|
|
+ // PATCH is required for custom-urls and update operations.
|
|
|
|
|
+ // Removing any method will cause CORS errors in the browser.
|
|
|
|
|
+ const defaultMethods = [
|
|
|
|
|
+ 'GET',
|
|
|
|
|
+ 'POST',
|
|
|
|
|
+ 'PUT',
|
|
|
|
|
+ 'PATCH',
|
|
|
|
|
+ 'DELETE',
|
|
|
|
|
+ 'OPTIONS'
|
|
|
|
|
+ ];
|
|
|
const allMethods = [...new Set([...defaultMethods, ...additionalMethods])];
|
|
const allMethods = [...new Set([...defaultMethods, ...additionalMethods])];
|
|
|
|
|
|
|
|
return {
|
|
return {
|