react proxy does not work
See original GitHub issueHi i am facing issue with react proxy … Actually i am accessing files from other port The proxy works for “/” but not for any other url like “/currentpost/images/” my proxy code is
"proxy": {
"/api/*": {
"target": "http://localhost:5000"
},
"/currentPost/images/*" : {
"target" : "http://localhost:5000"
},
"/images/*": {
"target": "http://localhost:5000"
}
}
and my proxy code in package js file is ps://user-images.githubusercontent.com/35171108/46656606-dfe41f80-cbc7-11e8-9d1c-9d1713814ca8.PNG)
Issue Analytics
- State:
- Created 5 years ago
- Comments:13 (5 by maintainers)
Top Results From Across the Web
proxy not working for react and node - Stack Overflow
25 Answers 25 · Delete package-lock.json and node_modules in React app · Turn off React Terminal and npm install all dependencies again on...
Read more >Proxy not working · Discussion #10149 · facebook/create-react ...
I've used "proxy": "http://localhost:8080" in my package.json for numerous other CRA projects to connect to my Express backend with no issues.
Read more >Proxy does not work with the React build version - JavaScript
Proxy works with 'npm start' but does not work with the React build version npm start version package.json { "name"…
Read more >React — How To Proxy To Backend Server - Medium
If you change the port in the proxy value in the package.json proxying calls to the API will not work. Create React App...
Read more >Why you should use a proxy server with Create React App
CRA supports proxying to mitigate or entirely eliminate these issues. In this article, we will discuss what a proxy server is, why you ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Perhaps this will help you: https://github.com/facebook/create-react-app/issues/5441#issuecomment-429981692
My
src/setupProxy.js
looks like this now (simplified):I recommend setting the logLevel so you’ll be aware when a route is or isn’t proxied.
hey
@USMAN378 @Timer I have struggled quite some time with the exact same problem, but then I removed the wild card * and everyhting works fine again. so try: app.use(proxy(‘/api/’, { target: ‘http://localhost:5000’ }))
Pierrick