Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save hagevvashi/ddf3cd2bcb61d21c5302b02dd6f4951d to your computer and use it in GitHub Desktop.
Save hagevvashi/ddf3cd2bcb61d21c5302b02dd6f4951d to your computer and use it in GitHub Desktop.
webpack-dev-serverのreverse proxy実装
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