Skip to content

Instantly share code, notes, and snippets.

@wichopy
Created July 12, 2018 02:38
Show Gist options
  • Select an option

  • Save wichopy/a9f3481d16f280d1629d2bc8c3372615 to your computer and use it in GitHub Desktop.

Select an option

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
Copy Markdown
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