Skip to content

Commit d1e0f3e

Browse files
fix(modern-js-plugin): set cors responseHeaders as * (#3088)
Co-authored-by: Zack Jackson <[email protected]>
1 parent 0da725b commit d1e0f3e

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

.changeset/sixty-camels-ring.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@module-federation/modern-js': patch
3+
---
4+
5+
fix(modern-js-plugin): set cors responseHeaders as \*

packages/modernjs/src/cli/configPlugin.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,7 @@ export const moduleFederationConfigPlugin = (
113113
'Access-Control-Allow-Origin': '*',
114114
'Access-Control-Allow-Methods':
115115
'GET, POST, PUT, DELETE, PATCH, OPTIONS',
116-
'Access-Control-Allow-Headers':
117-
'X-Requested-With, content-type, Authorization',
116+
'Access-Control-Allow-Headers': '*',
118117
},
119118
},
120119
},
@@ -130,7 +129,7 @@ export const moduleFederationConfigPlugin = (
130129
},
131130
enableAsyncEntry:
132131
bundlerType === 'rspack'
133-
? modernjsConfig.source?.enableAsyncEntry ?? true
132+
? (modernjsConfig.source?.enableAsyncEntry ?? true)
134133
: modernjsConfig.source?.enableAsyncEntry,
135134
},
136135
dev: {

packages/modernjs/src/cli/ssrPlugin.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,7 @@ export const moduleFederationSSRPlugin = (
102102
'Access-Control-Allow-Methods',
103103
'GET, POST, PUT, DELETE, PATCH, OPTIONS',
104104
);
105-
res.setHeader(
106-
'Access-Control-Allow-Headers',
107-
'X-Requested-With, content-type, Authorization',
108-
);
105+
res.setHeader('Access-Control-Allow-Headers', '*');
109106
fs.createReadStream(filepath).pipe(res);
110107
} else {
111108
next();

0 commit comments

Comments
 (0)