Prevent Cookies From Being Sent on AJAX Request

前端 未结 5 1157
庸人自扰
庸人自扰 2021-02-05 00:58

I have a web service that I invoke from script but that does not need any information stored in cookies. Anytime I make a request to the service, the cookie is sent along with i

5条回答
  •  野性不改
    2021-02-05 01:31

    Send AJAX requests to cookie-less subdomain on your server. So you app is www.mydomain.com and ajax requests are served from api.mydomain.com which you never set a cookie on. Also a great idea to do this with static files like images etc...

    see the "Use Cookie-free Domains for Components" section of http://developer.yahoo.com/performance/rules.html

提交回复
热议问题