Firebase-tools: Firebase 托管不遵守 firebase.json 中指定的重写规则

创建于 2017-11-11  ·  4评论  ·  资料来源: firebase/firebase-tools

我希望logo.svg/logo.svg提供服务,但其他一切由/index.html (单页应用程序)提供。 我为此指定了重写规则,如下所示:

"rewrites": [
  {
    "source": "logo.svg",
    "destination": "/logo.svg"
  },
  {
    "source": "**",
    "destination": "/index.html"
  }
]

但是,指向/logo.svg会从我的应用程序中给出 404。 所以第一个重写规则没有得到尊重。

最有用的评论

可能是您的浏览器的缓存问题? 两个网址都对我有用

2017 年 11 月 11 日星期六下午 3:21 Naresh Bhatia [email protected]
写道:

@mbleigh https://github.com/mbleigh ,感谢您的快速回复。
我试过你的建议。 如果我使用 firebase 域名,它可以工作,但是
与我们的真实域名无关。 你可以在这里试试:

  1. https://slidesup-website.firebaseapp.com/logo.svg - 这行得通
  2. https://slidesup.com/logo.svg - 这不是

请帮忙。


你收到这个是因为你被提到了。

直接回复此邮件,在 GitHub 上查看
https://github.com/firebase/firebase-tools/issues/534#issuecomment-343701347
或使线程静音
https://github.com/notifications/unsubscribe-auth/AAAD_qtow5N-g3SIgdNGH-phTF54cbjXks5s1ivtgaJpZM4Qan2H
.

所有4条评论

静态内容的完全匹配总是优先于重写——如果
您删除第一条规则并在您的公共目录中有一个 logo.svg 时
您部署这应该是您需要做的所有事情。 请向我们指出已部署的
如果您看到其他情况,请提供 URL,以便我们查看。

干杯,
迈克尔

2017 年 11 月 11 日星期六下午 12:21 Naresh Bhatia [email protected]
写道:

我想请求 logo.svg 由 /logo.svg 提供服务,但一切
否则由 /index.html(单页应用程序)。 我已经指定了重写规则
为此,如下:

“重写”:[
{
“来源”:“logo.svg”,
“目的地”:“/logo.svg”
},
{
“资源”: ”**”,
“目的地”:“/index.html”
}
]

但是,指向 /logo.svg 会从我的应用程序中给出 404。 所以第一个
重写规则不被遵守。


您收到此消息是因为您订阅了此线程。
直接回复此邮件,在 GitHub 上查看
https://github.com/firebase/firebase-tools/issues/534 ,或静音
线
https://github.com/notifications/unsubscribe-auth/AAAD_g4I857jiyUxe35--nbd1kfSUKzdks5s1gG8gaJpZM4Qan2H
.

@mbleigh ,感谢您的快速回复。 我试过你的建议。 如果我使用 firebase 域名,它可以工作,但不能使用我们的真实域名。 你可以在这里试试:

  1. https://slidesup-website.firebaseapp.com/logo.svg - 这行得通
  2. https://slidesup.com/logo.svg - 这不是

请帮忙。

可能是您的浏览器的缓存问题? 两个网址都对我有用

2017 年 11 月 11 日星期六下午 3:21 Naresh Bhatia [email protected]
写道:

@mbleigh https://github.com/mbleigh ,感谢您的快速回复。
我试过你的建议。 如果我使用 firebase 域名,它可以工作,但是
与我们的真实域名无关。 你可以在这里试试:

  1. https://slidesup-website.firebaseapp.com/logo.svg - 这行得通
  2. https://slidesup.com/logo.svg - 这不是

请帮忙。


你收到这个是因为你被提到了。

直接回复此邮件,在 GitHub 上查看
https://github.com/firebase/firebase-tools/issues/534#issuecomment-343701347
或使线程静音
https://github.com/notifications/unsubscribe-auth/AAAD_qtow5N-g3SIgdNGH-phTF54cbjXks5s1ivtgaJpZM4Qan2H
.

你说的对! 这是一个缓存问题。 非常感谢你的帮助。

此页面是否有帮助?
0 / 5 - 0 等级