【问题标题】:Angular 6 proxy not working anymoreAngular 6代理不再工作
【发布时间】:2018-06-19 11:32:45
【问题描述】:

我有一个 Angular 应用程序和一个 Web api。在本地进行测试,我使用代理配置文件:proxy.conf.json

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

一切正常。最近我更新到ng6。从那以后我收到以下错误:

[HPM] 尝试将请求 /api/data/GetCurrentUser/ 从 localhost:4200 代理到 http://localhost:50565 (ECONNREFUSED) 时出错

知道这里发生了什么吗? (我使用 ng serve --proxy-config proxy.conf.json)

【问题讨论】:

  • 端口错误..我太傻了..

标签: angular proxy


【解决方案1】:

请尝试


"changeOrigin": 真

【讨论】:

    猜你喜欢
    • 2015-12-08
    • 2018-11-25
    • 2018-12-18
    • 1970-01-01
    • 1970-01-01
    • 2019-01-24
    • 2019-01-27
    • 2019-12-18
    • 2019-01-29
    相关资源
    最近更新 更多