title: django set_cookie does not set cookie in browser
body: <p>I am writng a drf app, that sets cookie.
  I set cookie like this:</p>
  <pre><code>        serializer = TitleSerializer(result.titles, many=True)
          response = JsonResponse(serializer.data, safe=False)
          response.set_cookie(&quot;country_code&quot;, code)
          return response
  </code></pre>
  <p>But when I check request for cookies like this:</p>
  <pre><code>        if 'country_code' in request.COOKIES:
              print(request.COOKIES['country_code'])
  </code></pre>
  <p>I get nothing. I checked response object in browser console and it has them in headers:</p>
  <pre><code>Set-Cookie
      country_code=unknown; Path=/
  </code></pre>
  <p>and in cookies:</p>
  <pre><code>country_code    
  path    &quot;/&quot;
  value   &quot;unknown&quot;
  </code></pre>
  <p>But when I go to inspect&gt;storage&gt;cookies there is nothing there. Should I set cookies by hand in js or am I doing something wrong in django part? I just googled how to set cookies in django and it seemed like browser should set and send cookies automaticly, so I was curious what I'm doing wrong.</p>
  <p>EDIT:
  in comments under post similar question was suggested, I think it's connected with my problem, but unfortunately it doesen't solve my problem. I tried adding <code>credentials: 'include'</code> in my fetch request, but got an error:</p>
  <pre><code>Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at .... Reason: header ‘credentials’ is not allowed according to header ‘Access-Control-Allow-Headers’ from CORS preflight response)
  </code></pre>
  <p>I tried:</p>
  <pre><code>response[&quot;Access-Control-Allow-Headers&quot;]=&quot;true&quot;
  </code></pre>
  <p>but it also triggers error</p>
  <pre><code>Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at ... (Reason: CORS request did not succeed).
  </code></pre>