dtx6087 2010-02-12 14:42
浏览 110
已采纳

在第三方网站上加载来自bookmarklet的iframe会导致CakePHP会话失败

I am trying to pop up an iframe from a bookmark whose contents are from my test app. The test app doesn't do much but let me log in and set some session vars. First I developed this using Perl's Catalyst framework, and it worked great. I could log in to the test app in some window, or the iframe, and it would keep the session just fine on 3rd party sites.

Now I needed to do something similar in PHP using the CakePHP framework. For some reason, in every browser the session disappears when the iframe is opened on a 3rd party site. It opens just fine with the logged in session if it is launched on the development site (the same site that the iframe src is on). The CakePHP app is running on a standard Ubuntu Apache 2 install.

I found some docs talking about P3P headers in IE causing these sort of issues, but a) it's in all browsers, and b) I watched with Fiddler and saw the P3P header being sent.

I haven't watched the traffic from the Catalyst app to see what was different. I guess that's my next step, but frankly I've put enough time into this already. Thought I'd ask around and see what I could find out.

Thanks, Nick

  • 写回答

1条回答 默认 最新

  • dongye1934 2010-02-12 15:12
    关注

    This is by design I have discovered. CakePHP has settings in core.php that add extra security to the session handling.

    This page has some good tips:
    http://bakery.cakephp.org/articles/view/how-to-bend-cakephp-s-session-handling-to-your-needs

    Basically I did this:

    core.php

    Configure::write('Session.save', 'my_session_handler');
    

    my_session_handler.php

    ini_set('session.referer_check', ''); 
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 pip2.40更新pip2.43时报错
  • ¥15 换yum源但仍然用不了httpd
  • ¥50 C# 使用DEVMOD设置打印机首选项
  • ¥15 麒麟V10 arm安装gdal
  • ¥15 想用@vueuse 把项目动态改成深色主题,localStorge里面的vueuse-color-scheme一开始就给我改成了dark,不知道什么原因(相关搜索:背景颜色)
  • ¥20 OPENVPN连接问题
  • ¥15 flask实现搜索框访问数据库
  • ¥15 mrk3399刷完安卓11后投屏调试只能显示一个设备
  • ¥100 如何用js写一个游戏云存档
  • ¥15 ansys fluent计算闪退