0

I have been porting an angular1 project to the angular2-webpack-starter project. The front-end portion is working well enough that I attempted to connect the frontend to the backend server by setting up the proxy in the webpack.dev.js file as:

...
devServer: {
  proxy: {
    '/auth/*': {
      target: 'http://localhost:9000/auth/',
      secure: false
    }
  },
  port: METADATA.port,
  host: METADATA.host,
  historyApiFallback: true,
  watchOptions: {
    aggregateTimeout: 300,
    poll: 1000
  }
},
...

Something is clearly WRONG as: http://localhost:3000/auth/local is NOT proxied to the backend. So your help would be greatly appreciated. Or is the proxy stuff for the webpack-dev-server not yet working???

Thanks!!

JoelParke
  • 2,676
  • 2
  • 24
  • 38

1 Answers1

0
devServer: {
      port: METADATA.port,
      host: METADATA.host,
      historyApiFallback: true,
      proxy: {
        "/api": "http://localhost:3100"
      },
      watchOptions: {
        aggregateTimeout: 300,
        poll: 1000
      }
    }
Imran Ali
  • 2,223
  • 2
  • 28
  • 41
  • 1
    Welcome to Stack Overflow! While you may have solved this user's problem, code-only answers are not very helpful to users who come to this question in the future. Please edit your answer to explain why your code solves the original problem. – Joe C Feb 22 '17 at 06:42