Closed sourcesoldier closed 7 years ago
For anyone who uses Docker, running both back and front ends together with Docker Compose, change your
proxy
value inpackage.json
to the name of your back-end container. e.g."proxy": "http://server:8080"
. Yourdocker-compose.yaml
file should look similar to this:version: "3.8" services: client: container_name: client build: context: ./client ports: - "3000:3000" server: container_name: server build: context: ./server ports: - "8080:8080"
It worked for me! Thank you so much!
Proxy error: Could not proxy request /contact from localhost:3000 to http://localhost:8080/. [1] See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ECONNREFUSED).
above is the error from application the original port is 8080 but is showing port 3000 on my UI
I'm completely new to React and working on a Mac M1 computer. I was trying to fetch data from python flask application running on the same machine on port 5000. I set "proxy": "http://127.0.0.1:5000" in package.json file, but react couldn't fetch "/profile" from the flask application.
After reading some of the answers here, it made sense that I needed to change the react host, so I ran
export HOST=0.0.0.0
in the terminal.
This helped me solve the problem and now the react frontend fetches the profile data from flask successfully.
Finally, I solved it. I'm using react vite, and I had a issue which is connect ECONNREFUSED 127.0.0.1:5000. This 5000 port is the server port. I was trying to fetch data from a server, and ofc I need to put the same port on the proxy.
export default defineConfig({ server: { proxy: { "/api": "http://127.0.0.1:5000", }, }, plugins: [react()], });
Even though I wrote it down correctly, it was not working ... I found out that I have to run server, and then run client. If u don't run server-side, u will get a error like me . [vite] http proxy error at /api/cyberProducts: Error: connect ECONNREFUSED 127.0.0.1:5000
++ moreover I watched this vid, and helped me a lot (https://www.youtube.com/watch?v=N4yUiQiTvwU)
I think the solution to this is to run
node server.js
instead ofnpm start
Thank you so much for this! Fixed my issue after two hours.
I've experienced the same issue, I fixed it by adding this at the top of my
config.yml
file:host: 0.0.0.0 port: 3000
Any idea how to fix it on react app
the port is front file working number , right ?
如果其他人遇到这个问题,我总是如何解决它,在 package.json 代理中将 localhost 替换为 127.0.0.1
nice兄弟,这个问题控了我好久,thank you
I'm trying to run the mozaik2 demo locally on my Mac with npm installed thru homebrew.
It launches the browser window but then throws an error. Please see screenshot attached.
Current env versions:
npm -> 4.1.2 node -> 7.6.0