Last active
November 30, 2020 13:59
-
-
Save hagevvashi/ddf3cd2bcb61d21c5302b02dd6f4951d to your computer and use it in GitHub Desktop.
webpack-dev-serverのreverse proxy実装
This file contains 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
import { Configuration } from "webpack"; | |
const config: Configuration = { | |
devServer: { | |
proxy: [ | |
{ | |
context: ["/api/**"], | |
// VMだったらos.hostname()やos.type()を用いて柔軟に対応する | |
target: "http://localhost:4000", | |
pathRewrite: { "^/api": "" }, | |
}, | |
], | |
}, | |
}; | |
export default config; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment