I am developping a reactjs front end app with a nodejs/express backend.
Before, react side, I was accessing my nodejs through the address localhost:5000 but since I want to try it from my mobile device, I naively changed localhost to my @ip 192.168.X.X and as the title says, it does not work.
I am sharing an example of what I tried with the login feature since the server is supposed to send back a cookie.
Front end I use axios :
const result = await axios({
                method:'post',
                url:'http://192.168.X.X:5000/api/user/login',
                data:{
                    "emailLogin":login,
                    "password":password
                },
                withCredentials:true,
                headers: { crossDomain: true, 'Content-Type': 'application/json' },
            });
Backend I tried this :
const corsConfig = {
    credentials:true,
    origin:true,
}
app.use(cors(corsConfig));
This first configuration send me back a 200 http code but without any cookie.
I also tried this as backend :
const corsConfig = {
    credentials:true,
    origin:"*",
}
app.use(cors(corsConfig));
and this time, frontend side, I get the well known Access to XMLHttpRequest error.
I have read somewhere on stackoverflow that when origin is set to '*' credential is supposed to be set to false.
Also I would love to have a complete documentation about cors, react and nodejs but to be honest I couldn't find any that fix my problem.
To sum my problem up :
My reactjs frontend that will deployed on several devices with unknown addresses is supposed to send a POST request to a nodejs backend that will send back a cookie.
 
     
     
    