Change domain of Kentico CurrentContact cookie

可紊 提交于 2019-12-13 04:13:41

问题


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.

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?


回答1:


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>


来源:https://stackoverflow.com/questions/49760071/change-domain-of-kentico-currentcontact-cookie

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!