1

この質問が尋ねられたのを見たことがありますが、私の場合、すべての答えを試してみましたが、成功しなかったと思います。チームが開発しているアプリで VPN を介して Windows 資格情報で認証する必要があります。次に、サービスを提供する変更をテストする場合、--port 4200 --proxy-config proxy.config.jsを取得します。

[HPM] リクエスト http://localhost:4200/api/users/currentuser を localhost:4200 から http://localhost:4200 (ECONNRESET) にプロキシしようとしているときにエラーが発生しました ( https://nodejs.org/api/errors .html#errors_common_system_errors )

バックエンド NET Core Web プロジェクトの wwwroot フォルダーにデプロイすることでこれを回避しますが、ng serve と Angular Development Live Server のデバッグ機能は失われます。フロントエンドの大小の変更を視覚化するために毎回ビルドとコピーを行うのは時間がかかります。チームに http://localhost:4200 から完全な Angular アプリを提供できる人が 1 人いるのは興味深いことです。

私たちは常にVPNを使用して作業しているため、企業ネットワークに直接接続してこれがどのように動作するかはわかりません.

私は api と graphql コンテキストのみを使用します。これが私のプロキシ ファイルです。

const Agent = require('agentkeepalive');
// I tried also with NTLM version with same issue result
// const Agent = require('agentkeepalive-ntlm');

module.exports = {
        '/api': {
            target: 'http://localhost:53904',
            secure: false,
            pathRewrite : {"^/api" : "http://localhost:53904/api"},
            agent: new Agent({
                maxSockets: 100,
                keepAlive: true,
                maxFreeSockets: 10,
                keepAliveMsecs: 100000,
                timeout: 6000000,
                keepAliveTimeout: 90000
            }),
            onProxyRes: proxyRes => {
                let key = 'www-authenticate';
                proxyRes.headers[key] = proxyRes.headers[key] &&
                    proxyRes.headers[key].split(',');
            }
        },
      '/graphql': {
        target: 'http://localhost:53904',
        secure: false,
        pathRewrite : {"^/graphql" : "http://localhost:53904/graphql"},
        agent: new Agent({
            maxSockets: 100,
            keepAlive: true,
            maxFreeSockets: 10,
            keepAliveMsecs: 100000,
            timeout: 6000000,
            keepAliveTimeout: 90000
        }),
        onProxyRes: proxyRes => {
            let key = 'www-authenticate';
            proxyRes.headers[key] = proxyRes.headers[key] &&
                proxyRes.headers[key].split(',');
        }
    }
};

4

0 に答える 0