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

回答編集履歴

1

追記

2018/02/02 00:13

投稿

terumin
terumin

スコア17

answer CHANGED
@@ -23,4 +23,40 @@
23
23
  add_header Access-Control-Allow-Credentials true;
24
24
 
25
25
  add_header X-Frame-Options "ALLOW";
26
- ```
26
+ ```
27
+
28
+ アプリケーションとのコンフリクトに注意
29
+ -----
30
+
31
+ アプリケーション側でX-Frame-Optionsを付け足す設定になっている場合があり、
32
+ 自分の場合は[Ruby on RailsがデフォルトでSAMEORIGINを返すようになっていた](https://programming.wikihub.io/@r7kamura/20160617011257)ため、
33
+ Chromeではコンフリクトエラーが発生。
34
+
35
+ >エラー
36
+ ```
37
+ Refused to display 'https://hoge.com' in a frame because it set multiple 'X-Frame-Options' headers with conflicting values ('SAMEORIGIN, ALLOW'). Falling back to 'deny'
38
+ ```
39
+
40
+ >ヘッダ
41
+ ```
42
+ * Server nginx/1.10.1 is not blacklisted
43
+ < Server: nginx/1.10.1
44
+ < Date: Thu, 01 Feb 2018 23:59:11 GMT
45
+ < Content-Type: text/html; charset=utf-8
46
+ < Transfer-Encoding: chunked
47
+ < Connection: keep-alive
48
+ < X-Frame-Options: SAMEORIGIN
49
+ < X-XSS-Protection: 1; mode=block
50
+ < X-Content-Type-Options: nosniff
51
+ < ETag: W/"460d2cbdc5ecf1d7417e99fc879fd127"
52
+ < Cache-Control: max-age=0, private, must-revalidate
53
+ < X-Request-Id: 5c24d399-9c62-4ffe-b4fa-47caed6409e9
54
+ < X-Runtime: 0.013970
55
+ < Access-Control-Allow-Origin: *
56
+ < Access-Control-Allow-Methods: POST, GET, OPTIONS
57
+ < Access-Control-Allow-Headers: *
58
+ < Access-Control-Allow-Credentials: true
59
+ < X-Frame-Options: ALLOW
60
+ ```
61
+
62
+ 今回のケースでは結局、nginxの設定を削除し、rails側の設定でALLOWとする。