title: session not storing on browser in Django
body: <p>I'm trying to build an app using <code>React TSX</code> for the front-end side and <code>Django</code> for the back-end side. I want to store the session on the browser using the <code>SESSION_ENGINE=django.contrib.sessions.backends.signed_cookies</code>. So, I want to store the sessions in a similar way of how <code>PHP</code> or <code>Apache</code> stores its sessions. I have tried a lot of ways but I am still not able to store the sessions, I keep getting the output <code>SESSION IS NOW SET</code> from my code. Any help will be great. Thanks</p>
  <p><code>login.tsx</code></p>
  <pre><code>import Cookies from &quot;js-cookie&quot;;
  import axios, { AxiosResponse, AxiosError } from &quot;axios&quot;;
  
  ..........
  ..........
  
  axios.request({
      url: &quot;login/&quot;,
      baseURL: &quot;http://localhost:8000/&quot;,
      method: &quot;POST&quot;,
      data: data,
      timeout: 15000,
      withCredentials: true,
      headers: { &quot;X-Requested-With&quot;: &quot;XMLHttpRequest&quot;, &quot;X-CSRFToken&quot;: Cookies.get(&quot;csrftoken&quot;) },
      validateStatus: () =&gt; true
  }).then((res: AxiosResponse): void =&gt; {
      console.log(res.data);
  });
  </code></pre>
  <p><code>login.py</code></p>
  <pre><code>from django.http import HttpResponse
  
  def get(req):
      req.session.modified = True
  
      if req.session.get(&quot;user_id&quot;, False):
          return HttpResponse(&quot;EXISTS: &quot; + req.session.get(&quot;user_id&quot;))   &lt;-- THIS OUTPUT IS NEVER BEING RETRIEVED
      else:
          req.session[&quot;user_id&quot;] = &quot;USER-ID&quot;
          req.session.save()
          return HttpResponse(&quot;SESSION IS NOW SET&quot;)   &lt;-- THIS IS THE ONLY OUTPUT BEING RETRIEVED
  </code></pre>
  <p><code>settings.py</code></p>
  <pre><code>..........
  ..........
  
  INSTALLED_APPS = [
      'django.contrib.admin',
      'django.contrib.auth',
      'django.contrib.contenttypes',
      'django.contrib.sessions',
      'django.contrib.messages',
      'django.contrib.staticfiles',
      'corsheaders'
  ]
  
  SESSION_ENGINE = &quot;django.contrib.sessions.backends.signed_cookies&quot;
  SESSION_EXPIRE_AT_BROWSER_CLOSE = True
  SESSION_COOKIE_HTTPONLY = True
  SESSION_COOKIE_SECURE = True
  SESSION_COOKIE_NAME = &quot;sessioninfo&quot;
  
  CORS_ORIGIN_WHITELIST = [ &quot;http://localhost:5000&quot; ]
  CORS_ORIGIN_ALLOW_ALL = True
  CORS_ALLOW_CREDENTIALS = True
  CORS_ALLOW_METHODS = [&quot;GET&quot;,&quot;POST&quot;]
  CORS_ALLOW_HEADERS = [ &quot;accept&quot;, &quot;accept-encoding&quot;, &quot;authorization&quot;, &quot;content-type&quot;, &quot;dnt&quot;, &quot;origin&quot;, &quot;user-agent&quot;, &quot;x-csrftoken&quot;, &quot;x-requested-with&quot; ]
  
  CSRF_COOKIE_SECURE = True
  CSRF_COOKIE_HTTPONLY = True
  
  ..........
  ..........
  </code></pre>