title: How to resolve Chrome cookies resulting in nodejs ERR_CONNECTION_RESET when I have to store cookies olve
body: <p>Currently making a MERN app, so I am using Node. I have the user's information stored in localstorage so when they refresh the page they are still logged in. Problem is, if I were to make <strong>any api calls to my backend it will result in a net::ERR_CONNECTION_RESET</strong>. And it is also weird that the error message will look something like: <code>GET http://localhost:3000/api/roadmap/getAllRoadmapsButThumbnails net::ERR_CONNECTION_RESET</code>, when localhost:5000 is my backend port but it is showing 3000, my client port. </p>
  
  <p>My api calls perfectly fine when the user is logged out &amp; thus there is nothing in the localstorage. </p>
  
  <p>Has anyone encountered similar problems and have any insights? </p>
  
  <p><strong>What I have tried:</strong></p>
  
  <ol>
  <li><p>Changing proxy from just "<a href="http://localhost:5000" rel="nofollow noreferrer">http://localhost:5000</a>" to </p>
  
  <p><code>"proxy": {
      "secure": true,
      "target": {
        "host": "https://localhost",
        "port": 5000
      }
    },</code> </p></li>
  <li>Using full path in axios requests, this resulted in a CORS error, and I didn't proceed to make the CORS thing work because using the full path might cause weird stuff when website is deployed, and fixing the proxy routing seemed like a priority</li>
  </ol>
  
  <p><strong>More of my code</strong></p>
  
  <p>server.js: </p>
  
  <pre><code>const express = require("express");
  const mongoose = require("mongoose");
  const bodyParser = require("body-parser");
  const multer = require("multer");
  const path = require("path");
  const passport = require("passport");
  const users = require("./routes/api/users");
  const roadmap = require("./routes/api/roadmap");
  
  const app = express();
  
  // Bodyparser middleware
  app.use(
    bodyParser.urlencoded({
      extended: false
    })
  );
  app.use(bodyParser.json());
  // DB Config
  const db = require("./config/keys").mongoURI;
  // Connect to MongoDB
  mongoose
    .connect(
      db,
      { useNewUrlParser: true }
    )
    .then(() =&gt; console.log("MongoDB successfully connected"))
    .catch(err =&gt; console.log(err));
  
  // Passport middleware
  app.use(passport.initialize());
  // Passport config
  require("./config/passport")(passport);
  // Routes
  app.use("/api/roadmap", roadmap);
  app.use("/api/users", users);
  
  const port = process.env.PORT || 5000; // process.env.port is Heroku's port if you choose to deploy the app there
  </code></pre>
  
  <p>Everything is http right now, I didn't get errors like this in my last website which also utilized jwt stored in localstorage, that was about 5 months ago. </p>
  
  <p><strong>EDIT</strong></p>
  
  <p>new things I tried:</p>
  
  <ol>
  <li>Configuring the proxy manually </li>
  <li>Starting chrome without certificate</li>
  </ol>