Created
July 12, 2018 02:38
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"proxy": { | |
"/server": { | |
"target": "http://0.0.0.0:8080", | |
"changeOrigin": true | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 beapi
orbackend
"target" is the host and port the api is exposing inside your container.
"changeOrigin"` changes the origin of the host header to the target URLSee https://github.com/chimurai/http-proxy-middleware for more details.