I have a react app served on http://localhost:3000
.
I also have a kdb+ server on http://localhost:8080
.
I send HTTP request to the kdb+ to get data from the DB and because of CORS I added a proxy in the react app package.json file.
The problem is, that because I call the kdb+ server from http://localhost:8080/?getData
(without relative paths) and because when I call the kdb+ server inside the app I use fetch('/?getData')
(as described in this answer) react "knows" this url so it doesn't use the proxy.
How can I solve this?
Is there a way to set react to work only on http://localhost:3000/somepath
? I tried setting the homepage
parameter in the package.json file and the app worked both on /
and /somepath
.
Maybe the solution is to set kdb+ to listen on http://localhost:8080/sompath
? I searched for it and couldn't find a way to do that.