【发布时间】:2016-09-07 07:19:51
【问题描述】:
您好,我有一个 WebApp,我在其上使用带有 Javascript SDK 的 Application Insights。在 Chrome 开发人员工具中,我看到有 2 个不安全的 cookie,ai_user 和 ai_session。我已经更改了我的应用程序中的代码以使所有其他 cookie 都安全,但我无法设法让这些 cookie 也同样安全。我直接在Microsoft Application Insights documentation page上发了一个问题 他们告诉我更新脚本,这导致我修复了一个错误,但 cookie 仍然不安全(详细信息在我上面链接评论部分的评论中,目前是该部分中的第一个热门评论)。我问了他们,但他们不再回复我。
我当前用于初始化应用程序洞察力的代码是
var appInsights = window.appInsights || function (n) {
function t(n) { i[n] = function () { var t = arguments; i.queue.push(function () { i[n].apply(i, t) }) } } var i = { config: n }, u = document, e = window, o = "script", s = "AuthenticatedUserContext", h = "start", c = "stop", l = "Track", a = l + "Event", v = l + "Page", y = u.createElement(o), r, f; y.src = n.url || "CDN_PATH"; u.getElementsByTagName(o)[0].parentNode.appendChild(y); try { i.cookie = u.cookie } catch (p) { } for (i.queue = [], r = ["Event", "Exception", "Metric", "PageView", "Trace", "Dependency"]; r.length;) t("track" + r.pop()); return t("set" + s), t("clear" + s), t(h + a), t(c + a), t(h + v), t(c + v), t("flush"), n.disableExceptionTracking || (r = "onerror", t("_" + r), f = e[r], e[r] = function (n, t, u, e, o) { var s = f && f(n, t, u, e, o); return s !== !0 && i["_" + r](n, t, u, e, o), s }), i
}({
url: '//az416426.vo.msecnd.net/scripts/a/ai.0.js',
enableDebug: __solutionConfigurationIsDebug,
instrumentationKey: __applicationInsightsInstumentationKey
});
window.appInsights = appInsights;
appInsights.trackPageView('index.html');
我必须添加“url”属性,否则它指向“localhost/CDN_PATH”,这当然是错误的。
更新:我还在 GitHub 上找到了this issue,这似乎正是我正在寻找的东西,但它仍然开放......
【问题讨论】:
标签: javascript cookies azure-application-insights