Skip to content

Commit cff310c

Browse files
committed
fix: CORS error
1 parent 61a254c commit cff310c

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

.circleci/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ workflows:
277277
only:
278278
- develop
279279
- feature/recommender-sync-develop
280+
- remove-CORS
280281
# This is alternate dev env for parallel testing
281282
- "build-test":
282283
context : org-global

src/server/index.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,12 @@ async function onExpressJsSetup(server) {
146146
server.use(
147147
'/community-app-assets/api/tc-communities',
148148
(req, res, next) => {
149-
res.set('Access-Control-Allow-Headers', 'authorization');
150-
res.set('Access-Control-Allow-Origin', '*');
149+
res.header("Access-Control-Allow-Origin", "*");
150+
res.header("Access-Control-Allow-Methods", "GET,HEAD,OPTIONS,POST,PUT");
151+
res.header(
152+
"Access-Control-Allow-Headers",
153+
"Origin, X-Requested-With, Content-Type, Accept, Authorization"
154+
);
151155
next();
152156
},
153157
tcCommunitiesDemoApi,

0 commit comments

Comments
 (0)