更改Kentico CurrentContact cookie的域 [英] Change domain of Kentico CurrentContact cookie

查看:77
本文介绍了更改Kentico CurrentContact cookie的域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在sub.mydomain.com处安装了Kentico.使用sub.mydomain.com域创建CurrentContact cookie.我希望该Cookie能够被app.mydomain.com之类的其他子域读取.

I have a Kentico installation at sub.mydomain.com. The CurrentContact cookie is created using a domain of sub.mydomain.com. I want the cookie to be able to be read by other subdmains like app.mydomain.com.

有没有办法做到这一点?是否存在web.config设置或系统事件,我们可以在其中更改Cookie域?

Is there a way to accomplish this? Is there a web.config setting or a system event in which we can change the cookie domain?

推荐答案

如果为.mydomain.com发布了cookie,那么它将在所有子域(即sub.app.)上都可以访问,但反之亦然.从技术上讲,sub.mydomain.comapp.mydomain.com是浏览器预期的两个不同域.我认为您需要在Kentico web.config中为域app.domain.com启用CORS支持. 您可以尝试将类似的内容添加到您的web.config:

If a cookie is issued for .mydomain.com then it will be accessible on all sub domains i.e. sub. and app. but not vice versa. Technically is sub.mydomain.com and app.mydomain.com are two different domains from a browser prospective. I think you need to enable CORS support for domain app.domain.com in your Kentico web.config. You may try to add something like this to your web.config:

<httpProtocol>
  <customHeaders>
    <remove name="X-Powered-By" />
    <add name="Access-Control-Allow-Headers" value="Origin, X-Requested-With, Content-Type, Accept" />
    <add name="Access-Control-Allow-Methods" value="POST,GET,OPTIONS,PUT,DELETE" />
<add name="Access-Control-Allow-Origin" value="http://app.mydomain.com" />
<add name="Access-Control-Allow-Credentials" value="true" />
  </customHeaders>
</httpProtocol>

这篇关于更改Kentico CurrentContact cookie的域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆