Angular 6 proxy not working anymore

2019-03-02 13:59发布

I have an angular application and one web api. To test is locally, I use a proxy config file: proxy.conf.json

{
"/api": {
    "target": {
        "host": "localhost",
        "protocol": "http:",
        "port": 50565
    },
    "secure": false,
    "changeOrigin": false,
    "logLevel": "info"
    }
}

Everything was working fine. Recently I updated to ng6. Since then I get the following error:

[HPM] Error occurred while trying to proxy request /api/data/GetCurrentUser/ from localhost:4200 to http://localhost:50565 (ECONNREFUSED)

Any idea what's going on here? (I use ng serve --proxy-config proxy.conf.json)

标签: angular proxy
1条回答
叛逆
2楼-- · 2019-03-02 14:37

Please try


"changeOrigin": true

查看更多
登录 后发表回答