CoderTR CoderTR - 1 year ago 452
Javascript Question

Webpack-dev-server with bypass proxy

How to achieve a 'proxy' (similar to grunt-connect-proxy) option with webpack-dev-server ?

I am using webpack and webpack-dev-server with Grunt. A task in Gruntfile.js (below code) is able to start the server on port 8080. I want to add proxy setup for all the backend data requests (context URL /ajax/*).

"webpack-dev-server": {
options: {
webpack: webpackConfig,
publicPath: "/src/assets"
start: {
keepAlive: true,
watch: true

Answer Source

In the webpack config, you can use devServer.proxy like this:

proxy: {
    '/ajax/*': 'http://your.backend/'
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download