title: Django REST Framework - cookies not being set via Response.set_cookie() call...?
body: <p>I have the following standard Response setup in my DRF application:</p>
  
  <pre><code>response = Response(data=response, status=status.HTTP_200_OK)
  </code></pre>
  
  <p>I'm then attempting to add a split JWT <code>header.payload</code> and <code>signature</code> to the response headers with a <code>response.set_cookie()</code> call, as follows:</p>
  
  <pre><code>        max_age = 365 * 24 * 60 * 60
  
          expires = datetime.datetime.utcnow() + datetime.timedelta(seconds=max_age)
  
          response.set_cookie(
              key='JWT_ACCESS_HEADER_PAYLOAD',
              value=header_payload,
              httponly=False,
              expires=expires.strftime("%a, %d-%b-%Y %H:%M:%S UTC"),
              max_age=max_age
          )
  
          response.set_cookie(
              key='JWT_ACCESS_SIGNATURE',
              value=signature,
              httponly=True,
              expires=expires.strftime("%a, %d-%b-%Y %H:%M:%S UTC"),
              max_age=max_age
          )
  
          return response
  </code></pre>
  
  <p>I can't see anything wrong with what I have done thus far:</p>
  
  <p><a href="https://i.stack.imgur.com/FAzUx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FAzUx.png" alt="Client Side Response Headers"></a></p>
  
  <p>Yet, for some reason, the only cookies set on the client side are as follows:</p>
  
  <p><a href="https://i.stack.imgur.com/FUItl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FUItl.png" alt="Client Side Storage"></a></p>
  
  <p>What have I done wrong here??</p>
  
  <p>The actual output in the headers seem to be a valid SetCookie value:</p>
  
  <p><code>JWT_ACCESS_HEADER_PAYLOAD=aSasas; expires=Sat, 03-Apr-2021 10:24:31 GMT; Max-Age=31536000; Path=/</code></p>
  
  <p><code>JWT_ACCESS_SIGNATURE=asaSasaS; expires=Sat, 03-Apr-2021 10:24:31 GMT; HttpOnly; Max-Age=31536000; Path=</code></p>
  
  <p>N.B. Running on localhost...if that helps?</p>