更改Kentico CurrentContact cookie的域 [英] Change domain of 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.com
和app.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屋!