-1

When I'm making POST request with headers as content-type: application/JSON headers don't set a cookie in Request Headers. But when I change the headers as content-type: application/x-www-form-urlencoded headers set a cookie in Request Headers. Server accepts application/JSON format. Also, I have already given with-credentials: true on the client side.

lin
  • 17,956
  • 4
  • 59
  • 83

1 Answers1

0

Though the code is not available, I assume that setting the path parameter of the cookie will do the trick for you. The following may help:

cookies problem in PHP and AJAX

Why is the browser not setting cookies after an AJAX request returns?

Community
  • 1
  • 1
Syed Asghar
  • 1
  • 1
  • 3
  • Whilst this may theoretically answer the question, [it would be preferable](http://meta.stackoverflow.com/q/8259) to include the essential parts of the answer here, and provide the link for reference. – hg8 Mar 30 '17 at 10:30
  • Yes preference is right. But this answer is based on assumption of the essential part as that part of the code is not provided. – Syed Asghar Mar 30 '17 at 13:10