質問編集履歴
1
情報を追記しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -17,3 +17,31 @@
|
|
17
17
|
POST http://localhost:8080/api/v1/test net::ERR_INCOMPLETE_CHUNKED_ENCODING jquery.min.js:4
|
18
18
|
|
19
19
|
```
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
サーバー側はLaravel製のLumenを使っています。
|
24
|
+
|
25
|
+
Lumenでは、CorsMiddleware.phpを作って
|
26
|
+
|
27
|
+
```php
|
28
|
+
|
29
|
+
$headers = [
|
30
|
+
|
31
|
+
'Access-Control-Allow-Origin' => '*',
|
32
|
+
|
33
|
+
'Access-Control-Allow-Methods' => 'POST, GET, OPTIONS, PUT, DELETE',
|
34
|
+
|
35
|
+
'Access-Control-Allow-Credentials' => 'true',
|
36
|
+
|
37
|
+
'Access-Control-Max-Age' => '86400',
|
38
|
+
|
39
|
+
'Access-Control-Allow-Headers' => 'Content-Type, Authorization, X-Requested-With',
|
40
|
+
|
41
|
+
'Cache-Control' => 'no-cache'
|
42
|
+
|
43
|
+
];
|
44
|
+
|
45
|
+
```
|
46
|
+
|
47
|
+
という設定をしています。
|