質問編集履歴

1

'Access-Control-Allow-Origin'を削りましたが、実行結果としては同じ結果になりました。

2016/06/07 08:18

投稿

yohira0616
yohira0616

スコア257

test CHANGED
File without changes
test CHANGED
@@ -15,6 +15,74 @@
15
15
  XMLHttpRequest cannot load "https://awesome-api.server.com/api/login" Request header field Access-Control-Allow-Origin is not allowed by Access-Control-Allow-Headers in preflight response.
16
16
 
17
17
  ```
18
+
19
+
20
+
21
+ chromeのNetworkタブの通信結果はこんな感じです
22
+
23
+
24
+
25
+ **General**
26
+
27
+ Request URL:https://awesome-api.server.com/api/login
28
+
29
+ Request Method:OPTIONS
30
+
31
+ Status Code:200 OK
32
+
33
+ Remote Address:(情報保護のため伏せます)
34
+
35
+
36
+
37
+ **Response Headers**
38
+
39
+ Access-Control-Allow-Headers:Content-Type,X-Amz-Date,Authorization,X-Requested-With,X-Requested-By,X-Api-Key,X-Auth-Token
40
+
41
+ Access-Control-Allow-Methods:POST
42
+
43
+ Access-Control-Allow-Origin:*
44
+
45
+ Connection:keep-alive
46
+
47
+ Content-Length:18
48
+
49
+ Content-Type:application/json
50
+
51
+ Date:Tue, 07 Jun 2016 08:11:49 GMT
52
+
53
+ Via:1.1 1595f6e72d977d864a2806ced66554f2.cloudfront.net (CloudFront)
54
+
55
+ X-Amz-Cf-Id:eqeMld85btOJMKdiF6BQylYEB-NOlwq36r0hPNqkujHmXlngmOvSfg==
56
+
57
+ x-amzn-RequestId:7bdf2fa2-2c87-11e6-8972-9bd51d368f78
58
+
59
+ X-Cache:Miss from cloudfront
60
+
61
+
62
+
63
+ **Request Headers**
64
+
65
+ Accept:*/*
66
+
67
+ Accept-Encoding:gzip, deflate, sdch, br
68
+
69
+ Accept-Language:ja,en-US;q=0.8,en;q=0.6
70
+
71
+ Access-Control-Request-Headers:accept, access-control-allow-headers, access-control-allow-methods, content-type
72
+
73
+ Access-Control-Request-Method:POST
74
+
75
+ Cache-Control:max-age=0
76
+
77
+ Connection:keep-alive
78
+
79
+ Host:awesome-api.server.com
80
+
81
+ Origin:http://localhost:3002
82
+
83
+ Referer:http://localhost:3002/
84
+
85
+ User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36
18
86
 
19
87
 
20
88
 
@@ -41,8 +109,6 @@
41
109
  },
42
110
 
43
111
  headers:{
44
-
45
- 'Access-Control-Allow-Origin':'*',
46
112
 
47
113
  'Access-Control-Allow-Headers':'Content-Type,X-Amz-Date,Authorization,X-Requested-With,X-Requested-By,X-Api-Key,X-Auth-Token,Accept',
48
114