質問編集履歴

7

修正

2022/10/28 01:52

投稿

pom12345
pom12345

スコア12

test CHANGED
File without changes
test CHANGED
@@ -45,6 +45,7 @@
45
45
  ```
46
46
 
47
47
  パケットキャプチャソフトによる、プリフライト・リクエストと、2回目のリクエストはこちらです。
48
+
48
49
  ```
49
50
  // プリフライト・リクエスト(OPTIONS)
50
51
  OPTIONS ***
@@ -61,7 +62,7 @@
61
62
  Accept-Encoding: gzip, deflate, br
62
63
  Accept-Language: ja,en-US;q=0.9,en;q=0.8
63
64
 
64
- // GETア
65
+ // 2回目のリ
65
66
  GET ***
66
67
  Host: localhost
67
68
  Connection: keep-alive

6

修正

2022/10/28 01:51

投稿

pom12345
pom12345

スコア12

test CHANGED
File without changes
test CHANGED
@@ -44,5 +44,39 @@
44
44
  });
45
45
  ```
46
46
 
47
+ パケットキャプチャソフトによる、プリフライト・リクエストと、2回目のリクエストはこちらです。
48
+ ```
49
+ // プリフライト・リクエスト(OPTIONS)
50
+ OPTIONS ***
51
+ Host: localhost
52
+ Connection: keep-alive
53
+ Accept: */*
54
+ Access-Control-Request-Method: GET
55
+ Access-Control-Request-Headers: withcredentials
56
+ User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36
57
+ Origin: http://192.168.11.30:3000
58
+ Sec-Fetch-Site: cross-site
59
+ Sec-Fetch-Mode: cors
60
+ Sec-Fetch-Dest: empty
61
+ Accept-Encoding: gzip, deflate, br
62
+ Accept-Language: ja,en-US;q=0.9,en;q=0.8
47
63
 
64
+ // GETアクセス
65
+ GET ***
66
+ Host: localhost
67
+ Connection: keep-alive
68
+ sec-ch-ua: "Google Chrome";v="107", "Chromium";v="107", "Not=A?Brand";v="24"
69
+ Accept: application/json, text/plain, */*
48
70
 
71
+ withCredentials: true
72
+ sec-ch-ua-mobile: ?0
73
+ User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36
74
+ sec-ch-ua-platform: "Windows"
75
+ Origin: http://192.168.11.30:3000
76
+ Sec-Fetch-Site: cross-site
77
+ Sec-Fetch-Mode: cors
78
+ Sec-Fetch-Dest: empty
79
+ Accept-Encoding: gzip, deflate, br
80
+ Accept-Language: ja,en-US;q=0.9,en;q=0.8
81
+ ```
82
+

5

修正

2022/10/28 01:12

投稿

pom12345
pom12345

スコア12

test CHANGED
File without changes
test CHANGED
@@ -9,6 +9,8 @@
9
9
  ②他のPCも同じapacheのhttpd.confの設定をして、
10
10
  同じWebシステムからaxiosでlocalhostにアクセスしたところ、プリフライト・リクエスト?(2回送信)が発生した。
11
11
  Google Chromeコンソールに警告なし、何も表示なし。
12
+
13
+ 設定での対処方法がなければ、PHPでプリフライトリクエストを判定する方法があればよいのですが。
12
14
 
13
15
  わかるかたいらっしゃいましたらお願いします。
14
16
 

4

修正

2022/10/28 01:03

投稿

pom12345
pom12345

スコア12

test CHANGED
File without changes
test CHANGED
@@ -3,11 +3,11 @@
3
3
 
4
4
  (試したこと)
5
5
  ①apacheのhttpd.confとaxiosのヘッダにより、リクエストが、単純リクエストになるようにし
6
- 自分のPCで社内用Webシステムからaxiosでアクセスしたところ、プリフライト・リクエストが発生しなかった。
6
+ 自分のPCで社内用Webシステムからaxiosでlocalhostにアクセスしたところ、プリフライト・リクエストが発生しなかった。
7
7
  Google Chromeコンソールに警告なし、何も表示なし。
8
8
 
9
9
  ②他のPCも同じapacheのhttpd.confの設定をして、
10
- 同じWebシステムからaxiosでアクセスしたところ、プリフライト・リクエスト?(2回送信)が発生した。
10
+ 同じWebシステムからaxiosでlocalhostにアクセスしたところ、プリフライト・リクエスト?(2回送信)が発生した。
11
11
  Google Chromeコンソールに警告なし、何も表示なし。
12
12
 
13
13
  わかるかたいらっしゃいましたらお願いします。

3

修正

2022/10/28 00:53

投稿

pom12345
pom12345

スコア12

test CHANGED
File without changes
test CHANGED
@@ -12,7 +12,7 @@
12
12
 
13
13
  わかるかたいらっしゃいましたらお願いします。
14
14
 
15
- ### 現在のapacheの設定と、実行するコード
15
+ ### 現在のapacheの設定と、axiosでリクエストするコード
16
16
 
17
17
  apacheの設定
18
18
  ```httpd.conf
@@ -26,7 +26,7 @@
26
26
  </Directory>
27
27
  ```
28
28
 
29
- 実行するコード(localhostに対してgetアクセスしています。localhostはapacheの80ポートを利用)
29
+ axiosでリクエストするコード(localhostに対してgetアクセスしています。localhostはapacheの80ポートを利用)
30
30
  ```index.js
31
31
  axios({
32
32
  method: "get",

2

修正

2022/10/28 00:53

投稿

pom12345
pom12345

スコア12

test CHANGED
File without changes
test CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  (試したこと)
5
5
  ①apacheのhttpd.confとaxiosのヘッダにより、リクエストが、単純リクエストになるようにし
6
- 自分のPCでWebシステムからaxiosでアクセスしたところ、プリフライト・リクエストが発生しなかった。
6
+ 自分のPCで社内用Webシステムからaxiosでアクセスしたところ、プリフライト・リクエストが発生しなかった。
7
7
  Google Chromeコンソールに警告なし、何も表示なし。
8
8
 
9
9
  ②他のPCも同じapacheのhttpd.confの設定をして、

1

修正

2022/10/28 00:52

投稿

pom12345
pom12345

スコア12

test CHANGED
File without changes
test CHANGED
@@ -14,7 +14,7 @@
14
14
 
15
15
  ### 現在のapacheの設定と、実行するコード
16
16
 
17
- apacheの設定(url: http://localhost)
17
+ apacheの設定
18
18
  ```httpd.conf
19
19
  <Directory "C:/xampp/htdocs">
20
20
  # ...