Firebase-tools: Firebase hosting is not honoring rewrite rules specified in firebase.json

Created on 11 Nov 2017  Â·  4Comments  Â·  Source: firebase/firebase-tools

I'd like a request for logo.svg to be served by /logo.svg but everything else by /index.html (single page app). I have specified the rewrite rules for this as follows:

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

However pointing to /logo.svg gives a 404 from my app. So the first rewrite rule is not being honored.

Most helpful comment

Might be a caching issue with your browser? Both URLs work for me

On Sat, Nov 11, 2017, 3:21 PM Naresh Bhatia notifications@github.com
wrote:

Hi @mbleigh https://github.com/mbleigh, thanks for the quick response.
I tried your suggestion. It works if I use the firebase domain name, but
doesn't with our real domain name. You can try here:

  1. https://slidesup-website.firebaseapp.com/logo.svg - this works
  2. https://slidesup.com/logo.svg - this doesn't

Please help.

—
You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub
https://github.com/firebase/firebase-tools/issues/534#issuecomment-343701347,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAAD_qtow5N-g3SIgdNGH-phTF54cbjXks5s1ivtgaJpZM4Qan2H
.

All 4 comments

Exact matches for static content always have priority over rewrites -- if
you remove the first rule and have a logo.svg in your public directory when
you deploy that should be all you need to do. Please point us to a deployed
URL if you are seeing otherwise so we can take a look.

Cheers,
Michael

On Sat, Nov 11, 2017, 12:21 PM Naresh Bhatia notifications@github.com
wrote:

I'd like a request for logo.svg to be served by /logo.svg but everything
else by /index.html (single page app). I have specified the rewrite rules
for this as follows:

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

However pointing to /logo.svg gives a 404 from my app. So the first
rewrite rule is not being honored.

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/firebase/firebase-tools/issues/534, or mute the
thread
https://github.com/notifications/unsubscribe-auth/AAAD_g4I857jiyUxe35--nbd1kfSUKzdks5s1gG8gaJpZM4Qan2H
.

Hi @mbleigh, thanks for the quick response. I tried your suggestion. It works if I use the firebase domain name, but doesn't with our real domain name. You can try here:

  1. https://slidesup-website.firebaseapp.com/logo.svg - this works
  2. https://slidesup.com/logo.svg - this doesn't

Please help.

Might be a caching issue with your browser? Both URLs work for me

On Sat, Nov 11, 2017, 3:21 PM Naresh Bhatia notifications@github.com
wrote:

Hi @mbleigh https://github.com/mbleigh, thanks for the quick response.
I tried your suggestion. It works if I use the firebase domain name, but
doesn't with our real domain name. You can try here:

  1. https://slidesup-website.firebaseapp.com/logo.svg - this works
  2. https://slidesup.com/logo.svg - this doesn't

Please help.

—
You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub
https://github.com/firebase/firebase-tools/issues/534#issuecomment-343701347,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAAD_qtow5N-g3SIgdNGH-phTF54cbjXks5s1ivtgaJpZM4Qan2H
.

You are right! It was a caching issue. Thanks so much for your help.

Was this page helpful?
0 / 5 - 0 ratings