Google Chrome 不会在 Facebook Canvas Tab 应用程序中执行 POST

发布于 2024-12-17 19:41:53 字数 1891 浏览 2 评论 0原文

我相信这是一个很难回答的问题。

我已经使用以下选项配置了我的 Facebook 应用程序:

Page Tab URL: https://www.myapp.com.br/
Secure Page Tab URL: https://www.myapp.com.br/

(都是安全 URL 并使用 HTTPS 协议)

Firefox 和 Safari 等浏览器工作正常,当我打开页面时向服务器发送 POST 请求使用 http 或 https 协议的选项卡。

但是,当使用 facebook 和 http 时,Google Chrome 会执行 GET 请求。该请求不包含signed_request。

我花了很多时间试图解决这个问题,但我仍然不明白为什么会发生这种情况。谁能解释并提供解决方案吗?

更新(更多信息)

该应用程序是使用 Ruby on Rails 编写的。它是用 Nginx + Passenger 部署的。以下是应用程序与nginx的配置:

server {
    listen 80;
    listen 443 default ssl;
    server_name  www.myapp.com.br;
    passenger_enabled on;
    root /my/app/rails/folder/public;

    # workaround to get rid of infinite loops while using ssl
    passenger_set_cgi_param HTTP_X_FORWARDED_PROTO https;

}

Rails配置是强制ssl。

Nginx 访问日志,其中 Firefox 请求 facebook 页面选项卡:

201.87.25.128 - - [25/Nov/2011:19:16:47 -0200]“POST / HTTP/1.1”200 9693“http://static.ak.facebook.com/platform/page_proxy.php ?v=4" “Mozilla/5.0(Macintosh;Intel Mac OS X 10.7;rv:6.0.2)Gecko/20100101 火狐/6.0.2"

Nginx 访问日志,其中包含对 facebook 页面选项卡的 Google Chrome 请求:

201.87.25.128 - - [25/Nov/2011:19:19:07 -0200]“GET / HTTP/1.1”200 9678“http://static.ak.facebook.com/platform/page_proxy.php ?v=4" “Mozilla/5.0(Macintosh;英特尔 Mac OS X 10_7_2)AppleWebKit/535.2 (KHTML,如 Gecko)Chrome/15.0.874.121 Safari/535.2"

Nginx 访问日志,其中包含对 facebook SECURE 页面选项卡的 Google Chrome 请求:

201.87.25.128 - - [25/Nov/2011:19:18:43 -0200]“POST / HTTP/1.1”200 9678“https://s-static.ak.facebook.com/platform/page_proxy .php?v=4" “Mozilla/5.0(Macintosh;英特尔 Mac OS X 10_7_2)AppleWebKit/535.2 (KHTML,如 Gecko)Chrome/15.0.874.121 Safari/535.2"

I believe this is a difficult question to answer.

I've configured my facebook application with the following options:

Page Tab URL: https://www.myapp.com.br/
Secure Page Tab URL: https://www.myapp.com.br/

(both are secure urls and use HTTPS protocol)

Browsers like Firefox and Safari are working fine, sending a POST request to the server when I open the Page Tab with http or https protocol.

However, Google Chrome performs a GET request when using facebook with http. This request doesn't contain the signed_request.

I've spent a lot of time trying to fix this and I still don't understand why this is happening. Can anyone explain and provide a solution?

Update (more info)

The application was written with Ruby on Rails. It was deployed with Nginx + Passenger. The following is the configuration of the application with nginx:

server {
    listen 80;
    listen 443 default ssl;
    server_name  www.myapp.com.br;
    passenger_enabled on;
    root /my/app/rails/folder/public;

    # workaround to get rid of infinite loops while using ssl
    passenger_set_cgi_param HTTP_X_FORWARDED_PROTO https;

}

Rails configuration is to force ssl.

Nginx access log with a Firefox request to the facebook page tab:

201.87.25.128 - - [25/Nov/2011:19:16:47 -0200] "POST / HTTP/1.1" 200 9693 "http://static.ak.facebook.com/platform/page_proxy.php?v=4"
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:6.0.2) Gecko/20100101
Firefox/6.0.2"

Nginx access log with a Google Chrome request to the facebook page tab:

201.87.25.128 - - [25/Nov/2011:19:19:07 -0200] "GET / HTTP/1.1" 200 9678 "http://static.ak.facebook.com/platform/page_proxy.php?v=4"
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/535.2
(KHTML, like Gecko) Chrome/15.0.874.121 Safari/535.2"

Nginx access log with a Google Chrome request to the facebook SECURE page tab:

201.87.25.128 - - [25/Nov/2011:19:18:43 -0200] "POST / HTTP/1.1" 200 9678 "https://s-static.ak.facebook.com/platform/page_proxy.php?v=4"
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/535.2
(KHTML, like Gecko) Chrome/15.0.874.121 Safari/535.2"

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文