|
@@ -31,12 +31,15 @@ app.use(express.static('front'));
|
31
|
31
|
app.use(bodyParser.urlencoded({ extended: true }));
|
32
|
32
|
app.use(bodyParser.json());
|
33
|
33
|
// Allow cross-origin requests.
|
34
|
|
-app.use(cors({
|
|
34
|
+var corsOptions = {
|
35
|
35
|
origin: settings.formUrl,
|
36
|
36
|
optionsSuccessStatus: 200 // some legacy browsers (IE11, various SmartTVs) choke on 204
|
37
|
|
-}));
|
|
37
|
+};
|
|
38
|
+app.use(cors(corsOptions));
|
38
|
39
|
|
39
|
|
-app.all('/*', function(req, res, next) {
|
|
40
|
+app.options('*', cors(corsOptions));
|
|
41
|
+
|
|
42
|
+app.all('*', function(req, res, next) {
|
40
|
43
|
res.header('Access-Control-Allow-Headers', 'Content-Type')
|
41
|
44
|
next();
|
42
|
45
|
});
|