title: How to set cookies in localhost - ReactJS
body: <p>I know there are already a lot of questions similar to this but I couldn't find a solution yet.<br>
  I managed to deploy my React app on a server, and cookies work fine. Cookie is set by the server with <em>set-cookie</em> and then automatically included in all subsequent requests<br>
  However, I cannot make it work when I launch it on localhost: the cookie is not included in the requests after the server has set it. I think I tried all possible solutions that I found online and any possible combinations of them.<br>The command I use is <code>&quot;start&quot;: &quot;yarn run start&quot;</code><br>
  Things I tried:</p>
  <ul>
  <li>When the server sets the cookie, I tried to set it: <br> 1) both with and without <em>secure</em> option <br> 2) with <em>domain</em> set to null, false, '' and not set at all<br> 3) with and without <em>http-only</em></li>
  <li>I tried to use <em>localhost:3000</em>, <em>127.0.0.1:3000</em> and <em>my.site.it.localhost:3000</em></li>
  <li>I tried to set <code>127.0.0.1  my.site.it</code> in the host file and connect to <em>my.site.it:3000</em></li>
  <li>I tried to follow <a href="https://medium.com/@praveenmobdev/localhost-as-https-with-reactjs-app-on-windows-a1270d7fbd1f" rel="nofollow noreferrer">this guide</a> to use https in localhost and modify the launch command to<br><code>&quot;start&quot;: &quot;set HTTPS=true&amp;&amp;set SSL_CRT_FILE=./cert.crt&amp;&amp;set SSL_KEY_FILE=./cert.key&amp;&amp;yarn run start&quot;</code><br>and also to<br><code>&quot;start&quot;: &quot;set HOST=my.site.it&amp;&amp;set HTTPS=true&amp;&amp;set SSL_CRT_FILE=./cert.crt&amp;&amp;set SSL_KEY_FILE=./cert.key&amp;&amp;yarn run start&quot;</code><br></li>
  <li>I tried to set both <code>credentials: 'same-origin'</code> and <code>credentials: 'include'</code></li>
  <li>I tried to set <em>withCredentials</em> both to true and false</li>
  </ul>
  <p>Is there something I am missing? Any other thing left to try?<br>Thank you in advance</p>