Skip to content

Instantly share code, notes, and snippets.

@wichopy
Created July 12, 2018 02:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wichopy/a9f3481d16f280d1629d2bc8c3372615 to your computer and use it in GitHub Desktop.
Save wichopy/a9f3481d16f280d1629d2bc8c3372615 to your computer and use it in GitHub Desktop.
Connecting webpack dev server to an api hosted locally in a docker container
"proxy": {
"/server": {
"target": "http://0.0.0.0:8080",
"changeOrigin": true
}
}
@wichopy
Copy link
Author

wichopy commented Jul 12, 2018

This configuration will allow your webpack dev server (including create react app) to connect to an API you are running inside a docker container.

"/server" is whatever your api path is, could be api or backend
"target" is the host and port the api is exposing inside your container. "changeOrigin"` changes the origin of the host header to the target URL

See https://github.com/chimurai/http-proxy-middleware for more details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment