Sof*_*Gum 7 javascript http-headers node.js azure-functions
我正在尝试使用来自客户端javascript应用程序的google身份验证的azure功能(nodejs).我已经为正确的URL设置了CORS(即http:// localhost:8080).但我仍然收到以下错误:
凭据标志为"true",但"Access-Control-Allow-Credentials"标头为"".允许凭据必须为"true".因此,不允许来源" http:// localhost:8080 "访问.
我在互联网上到处尝试过,花了几天时间自己得到答案.Azure http响应似乎需要在标头中添加此Access-Control-Allow-Credentials:true.有没有办法添加自定义标头?
任何帮助将不胜感激.
在Node函数中,可以指定其他标头,如下所示:
module.exports = function (context, req) {
context.res = {
status: 200,
body: "Hello " + req.query.name,
headers: {
'Content-Type': 'text/plain',
'MyCustomHeader': 'Testing'
}
};
context.done();
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5893 次 |
| 最近记录: |