【问题标题】:Browsersync with Windows Authentication带有 Windows 身份验证的 Browsersync
【发布时间】:2015-09-09 08:01:30
【问题描述】:

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

我正在使用以下内容并认为这是由于标题不正确??

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

【问题讨论】:

  • 这方面有什么更新吗?
  • 看起来没有更新。有人找到答案了吗?

标签: windows authentication browser-sync


【解决方案1】:

这应该可行。 middleware 部分会将原始请求中的相关标头传递给 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();
            }
        }
});

【讨论】:

    猜你喜欢
    • 2013-06-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-06-08
    • 1970-01-01
    • 2019-12-05
    • 1970-01-01
    相关资源
    最近更新 更多