Browse Source

So an origin doesn't include a path. Well.

Brendan Abolivier 8 years ago
parent
commit
eaca3b4e59
Signed by: Brendan Abolivier <contact@brendanabolivier.com> GPG key ID: 8EF1500759F70623
2 changed files with 3 additions and 3 deletions
  1. 2
    2
      server.js
  2. 1
    1
      settings.example.json

+ 2
- 2
server.js View File

32
 app.use(bodyParser.json());
32
 app.use(bodyParser.json());
33
 // Allow cross-origin requests.
33
 // Allow cross-origin requests.
34
 var corsOptions = {
34
 var corsOptions = {
35
-  origin: settings.formUrl,
35
+  origin: settings.formOrigin,
36
   optionsSuccessStatus: 200 // some legacy browsers (IE11, various SmartTVs) choke on 204
36
   optionsSuccessStatus: 200 // some legacy browsers (IE11, various SmartTVs) choke on 204
37
 };
37
 };
38
 app.use(cors(corsOptions));
38
 app.use(cors(corsOptions));
39
-
39
+// Taking care of preflight requests
40
 app.options('*', cors(corsOptions));
40
 app.options('*', cors(corsOptions));
41
 
41
 
42
 
42
 

+ 1
- 1
settings.example.json View File

13
         "you@example.tld",
13
         "you@example.tld",
14
         "someone.else@example.com"
14
         "someone.else@example.com"
15
     ],
15
     ],
16
-    "formUrl": "https://example.tld/contact"
16
+    "formOrigin": "https://example.tld"
17
 }
17
 }