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

質問編集履歴

4

出直し

2017/05/05 05:29

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -113,4 +113,6 @@
113
113
  ###補足情報(言語/FW/ツール等のバージョンなど)
114
114
  HTMLは日本語を&#xxxx;化しています。
115
115
  JavaScriptはyuicompressor+jsPacker.plで圧縮しています。
116
- nginxのリバースプロクシを利用してSSL化をしているので、コンテンツサーバー側はhttpでアクセスされます。
116
+ nginxのリバースプロクシを利用してSSL化をしているので、コンテンツサーバー側はhttpでアクセスされます。
117
+
118
+ 出直し先:https://teratail.com/questions/74943

3

nginx\.conf変更

2017/05/05 05:29

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -76,9 +76,40 @@
76
76
  サーバーIP ほげほげ
77
77
 
78
78
  rawタグに基いて、以下のOpen Graphプロパティが構築されました
79
- (以下全部正常に認識してます)
80
79
  ----------------
81
80
 
81
+ ###試したこと追記 20170504
82
+ https://example.com/ (いいねの存在するTOPページ) だけ表示されなく
83
+ https://example.com/page.html 等はいいねが表示されているため、
84
+ nginx を以下のように変更して様子見中。
85
+
86
+ ```nginx
87
+ server {
88
+ listen 80;
89
+ server_name example.com;
90
+
91
+ proxy_set_header Host $host;
92
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
93
+ proxy_set_header X-Forwarded-Host $host;
94
+ proxy_set_header X-Forwarded-Server $host;
95
+ proxy_set_header X-Real-IP $remote_addr;
96
+
97
+ # Facebook only
98
+ location ~* {
99
+ proxy_cache zone1;
100
+ proxy_cache_key "$scheme://$host$request_uri$is_args$args";
101
+ proxy_cache_valid 200 1s;
102
+ if ($http_user_agent ~ facebookexternalhit) {
103
+ proxy_pass http://10.0.0.***:*****;
104
+ }
105
+ if ($http_user_agent !~ facebookexternalhit) {
106
+ rewrite ^(.*) https://$host$1 last;
107
+ }
108
+
109
+ }
110
+ }
111
+ ```
112
+
82
113
  ###補足情報(言語/FW/ツール等のバージョンなど)
83
114
  HTMLは日本語を&#xxxx;化しています。
84
115
  JavaScriptはyuicompressor+jsPacker.plで圧縮しています。

2

FBデバッガー

2017/05/04 01:47

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -65,6 +65,20 @@
65
65
  </body>
66
66
  </html>
67
67
  ```
68
+
69
+ Facebookデバッガーの結果
70
+ ----------------
71
+ スクレイピングの実行時間 7分前
72
+ レスポンスコード 200
73
+ 取得したURL https://ほげほげ/
74
+ カノニカルURL https://ほげほげ/ 2件のいいね!、シェア、コメント(詳細)
75
+ リンクをプレビュー (正常)
76
+ サーバーIP ほげほげ
77
+
78
+ rawタグに基いて、以下のOpen Graphプロパティが構築されました
79
+ (以下全部正常に認識してます)
80
+ ----------------
81
+
68
82
  ###補足情報(言語/FW/ツール等のバージョンなど)
69
83
  HTMLは日本語を&#xxxx;化しています。
70
84
  JavaScriptはyuicompressor+jsPacker.plで圧縮しています。

1

公式からとってきたHTMLでも動作しない

2017/05/02 07:28

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -46,6 +46,25 @@
46
46
  ###試したこと
47
47
  SSL可能な環境が本番環境しかないため、現状どのように解決すべきか模索中
48
48
 
49
+ https://developers.facebook.com/docs/plugins/like-button?locale=ja_JP
50
+ でとってきたコードすら動きませんでした。
51
+ http:// の別のサイトに置くと表示されます。
52
+
53
+ ```HTML
54
+ <html>
55
+ <body>
56
+ <div id="fb-root"></div>
57
+ <script>(function(d, s, id) {
58
+ var js, fjs = d.getElementsByTagName(s)[0];
59
+ if (d.getElementById(id)) return;
60
+ js = d.createElement(s); js.id = id;
61
+ js.src = "//connect.facebook.net/ja_JP/sdk.js#xfbml=1&version=v2.9";
62
+ fjs.parentNode.insertBefore(js, fjs);
63
+ }(document, 'script', 'facebook-jssdk'));</script>
64
+ <div class="fb-like" data-href="https://example.com/" data-layout="standard" data-action="like" data-size="small" data-show-faces="true" data-share="true"></div>
65
+ </body>
66
+ </html>
67
+ ```
49
68
  ###補足情報(言語/FW/ツール等のバージョンなど)
50
69
  HTMLは日本語を&#xxxx;化しています。
51
70
  JavaScriptはyuicompressor+jsPacker.plで圧縮しています。