Proxying API Requests in Docker Container running react app

后端 未结 2 1912
闹比i
闹比i 2021-01-25 20:17

I\'m running a simple react app in a docker container. During development I\'m using the proxy key in package.json to specify my backend api url: \"proxy\": \

2条回答
  •  执念已碎
    2021-01-25 20:51

    You're now running your React app inside a Docker container, so your "localhost" is no longer your local machine, but the container instead. You need to proxy-it to your backend's IP. Are you running the API in another container?

提交回复
热议问题