Webpack Dev Server proxy doesn't redirect to api backend

angularjs, apache, javascript, webpack, webpack-dev-server

Solution

Try to add

devServer: {
    publicPath: '/build/',
    port: 3000,
    proxy: {
        '/api': {
            target: 'http://gestios.loc/api'
            secure: false,
            changeOrigin: true
        }
    },
    historyApiFallback: true
}

I wish it helps

Problem

I try to redirect my "http://localhost:3000/api/" paths to a "http://example.com/api/" who runs in an apache server. There's my devServer config: ``` devServer: { publicPath: '/build/', port: 3000, proxy: { '/api': { target: 'http://gestios.loc/api' } }, historyApiFallback: true } ``` When i try to access to http://localhost:3000/api/calltek/apps?permalink=empresas in recieve a 404 error. ``` Request URL:http://localhost:3000/api/calltek/apps?permalink=empresas Request Method:GET Status Code:404 Not Found Remote Address:127.0.0.1:3000 Referrer Policy:no-referrer-when-downgrade HTTP/1.1 404 Not Found X-Powered-By: Express date: Fri, 05 May 2017 18:13:42 GMT server: Apache/2.4.23 (Win32) OpenSSL/1.0.2h PHP/5.6.28 vary: accept-language,accept-charset accept-ranges: bytes connection: close transfer-encoding: chunked content-type: text/html content-language: es ```

Original source

Related problems