Angular代理.NET核心后端每隔时间工作
遇到一些怪异的东西..试图从我的Angular应用中击中我的API。由于我们需要使用Windows身份验证,因此我们需要为Angular设置代理。Conf,以便它可以正确传递凭据。 这是我的proxy.conf.js:
const agent = require('agentkeepalive');
module.exports = {
'/api': {
target: 'http://localhost:44366',
secure: false,
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(',');
},
},
};
如果没有失败,我的第一个请求就成功了,但以下请求每次都会失败502。
Running into some weird stuff.. Trying to hit my api from my angular app. Since We need to use windows authentication we need to setup a proxy.conf for angular so it can pass credentials correctly.
Here is my proxy.conf.js:
const agent = require('agentkeepalive');
module.exports = {
'/api': {
target: 'http://localhost:44366',
secure: false,
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(',');
},
},
};
Getting these errors every other request:
Without fail my first request succeeds but the following request fails with 502 every time.
Has anyone ever seen something like this before?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试一下,但我对上述端口号不信心 - 您必须为HTTPS和Web API路由设置代理配置,此代码是我的Proxy.conf.js的示例
try this but im not confident with your port number mentioned above - you have to set proxy configuration for https and routes of web api, this code is example from my proxy.conf.js for new Visual Studio Template