Skip to content

Commit 1f439ba

Browse files
authored
Remove CORS verification (#1059)
* Use Sofia.url for CORS configuration * hardcode CORS * remove cors entirely
1 parent 7843f82 commit 1f439ba

File tree

3 files changed

+1
-23
lines changed

3 files changed

+1
-23
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
"babel-eslint": "^10.1.0",
4141
"bootstrap": "^5.2.3",
4242
"broccoli-asset-rev": "^3.0.0",
43-
"cors": "^2.8.5",
4443
"ember-async-data": "^0.7.0",
4544
"ember-auto-import": "^2.2.4",
4645
"ember-bootstrap": "^5.1.1",

server/index.js

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,32 +10,12 @@
1010
// };
1111

1212
module.exports = function (app) {
13-
const cors = require('cors');
1413
const globSync = require('glob').sync;
1514
const mocks = globSync('./mocks/**/*.js', { cwd: __dirname }).map(require);
1615
const proxies = globSync('./proxies/**/*.js', { cwd: __dirname }).map(
1716
require
1817
);
1918

20-
// Hardcoded allowed origins for CORS
21-
const allowedOrigins = new Set([
22-
'http://localhost:5000',
23-
'https://stagingstreep.csvalpha.nl',
24-
'https://streep.csvalpha.nl',
25-
]);
26-
27-
app.use(
28-
cors({
29-
origin: function (origin, callback) {
30-
// Allow requests with no origin (like mobile apps or curl)
31-
if (!origin) return callback(null, true);
32-
if (allowedOrigins.has(origin)) return callback(null, true);
33-
return callback(new Error('Not allowed by CORS'));
34-
},
35-
credentials: true,
36-
})
37-
);
38-
3919
// Log proxy requests
4020
const morgan = require('morgan');
4121
app.use(morgan('dev'));

yarn.lock

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5537,7 +5537,6 @@ __metadata:
55375537
babel-eslint: ^10.1.0
55385538
bootstrap: ^5.2.3
55395539
broccoli-asset-rev: ^3.0.0
5540-
cors: ^2.8.5
55415540
ember-async-data: ^0.7.0
55425541
ember-auto-import: ^2.2.4
55435542
ember-bootstrap: ^5.1.1
@@ -9685,7 +9684,7 @@ __metadata:
96859684
languageName: node
96869685
linkType: hard
96879686

9688-
"cors@npm:^2.8.5, cors@npm:~2.8.5":
9687+
"cors@npm:~2.8.5":
96899688
version: 2.8.5
96909689
resolution: "cors@npm:2.8.5"
96919690
dependencies:

0 commit comments

Comments
 (0)