I have react app with proxy to my node js server http://localhost:3000 and http://localhost:9000
In my package.json react app:
...
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"proxy": "http://localhost:9000",
...
Some request wrong works.
Example:
I on http://localhost:3000/admin on my react app and i create request to server
fetch('admin/check-token',
{
method: "GET",
headers: {
'Content-Type': 'application/json',
'Authorization':Cookie.getCookie(TOKEN)
},
})
.then(response => {
return response.json();
})
.then((json) => {
console.log(json)
})
.catch(function (res) {
console.log(res)
})
I need request to http://localhost:9000/admin/check-token, but i have error and chrome show me that i send request to http://localhost:9000/admin/admin/check-token.
As I understand it, the extra /admin is taken from http://localhost:3000/admin.
What am I doing wrong?