File tree Expand file tree Collapse file tree 1 file changed +17
-7
lines changed Expand file tree Collapse file tree 1 file changed +17
-7
lines changed Original file line number Diff line number Diff line change @@ -17,14 +17,24 @@ module.exports = function (app) {
1717 require
1818 ) ;
1919
20- // Use `sofiaUrl` only from env or Ember config (no hardcoded fallbacks).
21- // Load Ember config function with the current environment if provided.
22- const config = require ( '../config/environment' ) (
23- process . env . EMBER_ENV || process . env . NODE_ENV
24- ) ;
25- const sofiaUrl = process . env . SOFIA_URL || config . sofiaUrl ;
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+ ] ) ;
2626
27- app . use ( cors ( { origin : sofiaUrl } ) ) ;
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+ ) ;
2838
2939 // Log proxy requests
3040 const morgan = require ( 'morgan' ) ;
You can’t perform that action at this time.
0 commit comments