【问题标题】:Firebase hosting : Detect social media crawler bots like facebook, twitter and googleFirebase 托管:检测 facebook、twitter 和 google 等社交媒体爬虫机器人
【发布时间】:2018-03-16 18:29:03
【问题描述】:

我目前有像这样重定向到 index.html 的 firebase 托管设置。

{
  "database": {
    "rules": "database.rules.json"
  },
  "hosting": {
    "public": "build",
    "rewrites": [
      {
        "source": "**",
        "destination": "/index.html"
      },
      {
        "source": "/details/**",
        "function": "details"
      }
    ]
  }
}

但我想基于 Facebook 的 Facebot 等用户代理重定向请求......

有没有办法在到达云功能之前重定向 Firebase 托管上的请求? 我知道这在函数内部是可能的,但我很想在托管配置上这样做。

【问题讨论】:

  • 我也想知道这个问题的答案
  • 检测用户代理,如果你发现它匹配机器人重定向到你的服务器元标记配置的html。
  • @dshukertjr 我也是!

标签: node.js facebook firebase firebase-hosting


【解决方案1】:

我终于设法通过创建一个重定向机器人请求的云函数来解决这个问题。 您可以使用请求的用户代理来识别机器人。

【讨论】:

    猜你喜欢
    • 2021-08-13
    • 1970-01-01
    • 2012-04-26
    • 2012-10-04
    • 2011-10-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多