I am trying to configure proxy for webpack-dev-server and rails bundles. I set up rails at http://192.168.1.223.06000/. Trying to configure the proxy on the client

webpack.config.js

const path = require("path"); const webpack = require("webpack"); module.exports = { entry: { index: [ "./src/init" ], }, output: { publicPath: "/", path: __dirname + "/public/", filename: "[name].js" }, module: { loaders: [{ test: /\.js$/, exclude: /(node_modules)/, loaders: ["react-hot", "babel"] }] }, devServer: { contentBase: "./public", hot: true, historyApiFallback: true, proxy: { "/api": { target: "http://192.168.1.223:3000/", pathRewrite: { "^/api": "" } } } } }; 

I run the dev-server on port 8080. I open http: // localhost: 8080 / api , I see that all requests for Rails arrive in the form http: //192.168.1.223.73000/api/request although I ask to send requests to http: / /192.168.1.223a000/request how do i fix this? enter image description here

    1 answer 1

    The fact was that the version of webpack-dev-server was <1.15.0