【问题标题】:Firebase custom domain not getting requested headersFirebase 自定义域未获得请求的标头
【发布时间】:2018-10-17 06:49:04
【问题描述】:

我正在尝试创建一个 Google Cloud Function (GCF),以检查是否添加了请求的标头,然后继续工作。 GCF 正在努力: https://us-central1-*******.cloudfunctions.net/NowShowing 通常,但如果我们添加自定义域 https://******.firebaseapp.com 并运行云功能 https://******.firebaseapp.com/NowShowing,云函数未获取请求的标头且无法正常工作

exports.NowShowing = functions.https.onRequest((request, response) => {
cors(request, response, () => {
    if (request.header('_api_key') == "whatever") {
     // code
    }
 })
})

知道如何解决

【问题讨论】:

  • 已修复....带有“_”字符的标头不被接受
  • 听起来像是一个很好的自我回答@allo! :-)

标签: firebase http http-headers google-cloud-functions


【解决方案1】:

我看到您已经找到了您自己问题的答案。没错,不接受带有“_”字符的标题。

您可以在此处查看更多信息:

what characters are allowed in HTTP header values?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-03-27
    • 2023-03-21
    • 2016-06-24
    • 1970-01-01
    • 2014-08-08
    • 2013-11-13
    相关资源
    最近更新 更多