cerealex
cerealex

Reputation: 1691

Firebase hosting config, rewrite everything but one url

Here's my firebase.json. I'm trying redirect /sitemaps to a dynamically generated sitemaps in Firebase Storage. Unfortunately rewrites wildcard for the rest of routes overwrites the redirection. How would be the best way to specify to rewrite everything but that one url?

    "redirects": [
      {
        "source" : "/sitemaps",
        "destination" : "https://firebasestorage.googleapis.com/v0/b/foo",
        "type" : 301
      }
    ],
    "rewrites": [
      {
        "source": "**",
        "function": "bar"
      }
    ]

Upvotes: 0

Views: 1274

Answers (1)

Martin Zeitler
Martin Zeitler

Reputation: 76849

one can negate the condition with a !, in order to exclude.

"rewrites": [{
   "source": "!/sitemaps",
   "destination": "/index.html"
}, {
  "source": "**",
  "destination": "/index.html"
}]

Upvotes: 5

Related Questions