These are chat archives for webpack/webpack/dev

8th
Sep 2016
philipsadman
@philipsadman
Sep 08 2016 15:55

Hi guys! I'm using webpack + webpack-dev-server, and my issue is that proxy's option rewritePath does not work at all or works incorrect. Here is my config:

devServer: {
historyApiFallback: true,
proxy: {
  '/api': {
    target: 'http://localhost:8080',
    pathRewrite: { '/api': '' }
  }
}
}

I've already tried different sets of pathRewrite option and nothing helped me yet. The only solution which help me is:

proxy: {
  '**': {
    target: 'http://localhost:8080'
  }
}

but I need definitely to rewrite '/api' in my requests path with ''. Thank a lot for attention