Why can't I get cookies from ngrok using node js?

Viewed 386

I'm trying to parse cookies from the client to the server using node js. Everything works fine, but when I switch from localhost to an ngrok url, cookies are not parsed. Actually every time I call req.cookies["username"] I get undefined as a response from the server.

This is the important part from my ap.js:

app.ws('/', function(ws, req, res) {
console.log(req.cookies["username"]) });

Although, I don't think that this is a coding problem. I've installed every dependency and as I said cookie is successfully sent from client to server on localhost but not when I start ngrok. Something must be wrong with the random ngrok subdomain or/and with the ngrok server. I've tried Chrome and Firefox. Both have the same issue.

I have windows 7 64bit using node js v10.22.0.

0 Answers
Related