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', ''); 
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 树莓派与pix飞控通信
  • ¥15 自动转发微信群信息到另外一个微信群
  • ¥15 outlook无法配置成功
  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题