尝试代理 angular 4 项目时出错,URL 配置为 HTTPS

Error occured while trying to proxy on angular 4 rpoject, URL configured for HTTPS

我一直在尝试点击 angular 4 项目,使用 HTML 页面的形式在我的机器上本地部署在端口 4200 :-

<!DOCTYPE html>
<html>
<body>
  <form action="https://test-pubg.sohum.com:4200" target="_blank" method="post">
    Access: <input type="text" id="accessToken" name="accessToken"><br> Refresh: <input type="text" id="refreshToken" name="refreshToken"><br>
    <button type="submit">Submit</button><br>
  </form>

</body>

</html>

但我得到

Error occured while trying to proxy to: test-pubg.sohum.com:4200/

在浏览器上。

我在package.json中配置了https的路由配置如下:

"start": "ng serve --disable-host-check --ssl 1 --proxy-config proxy.conf.json --host 0.0.0.0",

我在proxy.conf.json中的代理设置如下:-

{
    "/**": {
        "target": {
            "host": "test-pubg.sohum.com",
            "port": 8080,
            "protocol": "http:"
        },
        "secure": false,
        "changeOrigin": true,
        "logLevel": "debug"
    }
}

我已经在 github 和 Whosebug 上的其他类似线程上尝试了所有可能的解决方案。但是直到现在都没有任何效果。

我是 angular 的新手并且已经花了好几天时间。任何可能的解决方案将不胜感激。

所以在花了很多时间后我发现它与架构问题有关。首先,尝试了解架构:- HTML(在一些不同的服务器上)-> angular(HTTPS) -> spring boot

所以问题是 Angular 试图从 HTTPS angular 到非 HTTP Spring 启动。因此,作为解决方案,我为 spring 启动配置了 HTTPS & 瞧!有效。