gpt4 book ai didi

windows - 浏览器与 Windows 身份验证同步

转载 作者:可可西里 更新时间:2023-11-01 12:42:10 26 4
gpt4 key购买 nike

我在 .NET 应用程序中使用 Browsersync。我已将 iis 设置为仅使用 Windows 身份验证(禁用匿名身份验证)。我得到 402.1。当然,我可以将匿名设置为启用,它会加载页面,但我将处于匿名状态,这不是想要的结果。我不太确定要在 Browsersync 中设置哪些选项才能使其在 Windows 身份验证模式下工作。

我正在使用下面的内容,并认为这是由于标题不正确造成的??

browserSync.init({
proxy: {
target: 'http://localhost:4300',
reqHeaders: {
"host": config.urlObj.host,
"accept-encoding": "identity",
"agent": false
}
}
});

最佳答案

这应该有效。 中间件 部分会将原始请求中的相关 header 传递给 IIS。

browserSync.init({
proxy: {
target: 'http://localhost:4300',
reqHeaders: {
"accept-encoding": "identity",
"agent": false
},
middleware: function (req, res, next) {
if (req.headers.x-logon-user) {
res.setHeader("X-Logon-User", req.headers.x-logon-user);
}
if (req.headers.authorization) {
res.setHeader("Authorization", req.headers.authorization);
}
next();
}
}
});

关于windows - 浏览器与 Windows 身份验证同步,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31004173/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com