Proxy feature in package.json
Can you reproduce the problem with latest npm?
Yes, I'm using the last stable npm version.
stable -> 6.9 (-> v6.9.1) (default)
Can you still reproduce it? I updated and I reproduced the issue.
Description
I'm using the proxy configuration and it seems it doesn't work.
Expected behavior
I'm calling an API REST. I configured the package.json with:
"proxy": "http://10.116.12.170:8080",
but doesn't work.
Actual behavior
I have this action:
function fetchMetadades(dispatch) {
return dispatch => {
dispatch(requestMetadades())
return fetch(`/vars/metadades`)
.then(response => response.json())
.then(json => dispatch(receiveMetadades(json)))
}
}
and the response.url must have http://10.116.12.170:8080/vars/metadades but have http://localhost:3000/vars/metadades. The json() call fails.
Environment
Run these commands in the project folder and fill in their results:
npm ls react-scripts(if you haven’t ejected):[email protected]node -v:v6.9.1npm -v:4.0.5
Then, specify:
- Operating system:
Linux 4.4.0-57-generic - Browser and version:
Google Chrome 55
Forget it. It was my fault. It was a problem of the Server. I used the @CrossOrigin label in Spring and now works. Sorry for the mistake.
In my case throwing cross origin error backend on rails (s3 server) but my project is on localhost