teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

情報を追記しました。

2016/11/04 07:22

投稿

mhl
mhl

スコア34

title CHANGED
File without changes
body CHANGED
@@ -7,4 +7,18 @@
7
7
  エラーメッセージ
8
8
  ```
9
9
  POST http://localhost:8080/api/v1/test net::ERR_INCOMPLETE_CHUNKED_ENCODING jquery.min.js:4
10
- ```
10
+ ```
11
+
12
+ サーバー側はLaravel製のLumenを使っています。
13
+ Lumenでは、CorsMiddleware.phpを作って
14
+ ```php
15
+ $headers = [
16
+ 'Access-Control-Allow-Origin' => '*',
17
+ 'Access-Control-Allow-Methods' => 'POST, GET, OPTIONS, PUT, DELETE',
18
+ 'Access-Control-Allow-Credentials' => 'true',
19
+ 'Access-Control-Max-Age' => '86400',
20
+ 'Access-Control-Allow-Headers' => 'Content-Type, Authorization, X-Requested-With',
21
+ 'Cache-Control' => 'no-cache'
22
+ ];
23
+ ```
24
+ という設定をしています。