I have an api created and hosted on Heroku
. I have my web app running on localhost. I am using NextJS
for my app. I am able to access all my apis hosted on Heroku via my web app which is running on localhost
. I have one api which checks whether a cookie is available or not, I am calling the api in the getInitialProps
method of the _app.js
file of my NextJS
app which is the entry point of the framework. If I comment that api call code then I don't get any error , but I need to check whether cookie is present or not so calling that code gives an error saying
Hostname/IP does not match certificate's altnames: Host: localhost. is not in the cert's altnames: DNS:*.herokuapp.com, DNS:herokuapp.com
Also my cookie
is not saved in the browser when I login. It works fine on postman
so no problem from my api side and I can see the cookie in the postman.
I did set following in my NodeJS app
app.set("trust proxy", true);
I am using the cookie-session
library in my express
Nodejs
app