代理上的setcookie不起作用

时间:2012-12-16 22:30:26

标签: php apache cookies proxy setcookie

由于同源政策,我想通过代理将表格发送到另一个网站。因此,将其添加到虚拟主机配置:

ProxyPass /submit http://another.website.com/
ProxyPassReverse /submit http://another.website.com/

有效。我的表单成功发布,没有错误。但是,有两个问题:

  1. Cookie不符合请求。我想要包含相关的cookie 使用我的another.website.com请求发送到AJAX

  2. 我在目标网页(我通过代理发布表单)中设置了一个cookie,使用以下代码:

    setcookie("TestCookie", "blah blah", time() + 3600, '/', '.another.website.com');
    

    但是,当试图在http://another.website.com/search上获取该Cookie时,我找不到这个。并且$_COOKIE['TestCookie']为NULL。 (Firebug也没有显示cookie)

  3. 编辑:第二个问题已解决。 (I can't set cookie for another domain,我做了什么)。

    编辑:表单位于“localhost”,我想将其提交到“another.website.com”。

0 个答案:

没有答案
相关问题