瀏覽代碼

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

Brendan Abolivier 8 年之前
父節點
當前提交
eaca3b4e59
簽署人: Brendan Abolivier <contact@brendanabolivier.com> GPG 金鑰 ID: 8EF1500759F70623
共有 2 個文件被更改,包括 3 次插入3 次删除
  1. 2
    2
      server.js
  2. 1
    1
      settings.example.json

+ 2
- 2
server.js 查看文件

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

+ 1
- 1
settings.example.json 查看文件

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