【问题标题】:Firebase Hosting Rewrite URLFirebase 托管重写 URL
【发布时间】:2021-08-07 01:33:24
【问题描述】:

有什么办法可以在 firebase.json 中重写这个 URL 吗?

http://localhost/api/随便/product.json

成为

http://localhost/api/product.json

whatever 表示任何类型的路径,所以我希望如果我们插入那个 whatever 路径,那么浏览器将不会重定向到 404,而是重定向到

http://localhost/api/product.json

谢谢

【问题讨论】:

    标签: firebase redirect url-rewriting firebase-hosting


    【解决方案1】:

    据我所知,这是一个非常常规的重写,使用 glob 模式。根据Firebase Hosting rewrites 上的文档,它应该类似于:

    "hosting": {
      // ...
    
      "rewrites": [{
        "source": "**/product.json",
        "destination": "/api/product.json"
      }]
    }
    

    【讨论】:

      猜你喜欢
      • 2020-11-01
      • 1970-01-01
      • 2021-03-06
      • 1970-01-01
      • 1970-01-01
      • 2020-05-14
      • 2017-12-09
      • 1970-01-01
      • 2018-04-11
      相关资源
      最近更新 更多