Specify what firebase hosting config use when deploying

Viewed 11

I am using firebase to deploy a react application. I have 3 environments, dev/stg/prod.

I would like to set the header to "NO CACHE" in dev and stg but allow cache in production.

so basically :

for prod

{
  "hosting": [
    {
      "target": "core",
      "public": "dist/apps/core",
      "ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
      "headers": [
        {
          "source": "**/*.@(jpg|svg|jpeg|gif|png|js|css)",
          "headers": [
            {
              "key": "Cache-Control",
              "value": "max-age=5256000"
            }
          ]
        },
        {
          "source": "**/*.@(eot|otf|ttf|ttc|woff|font.css)",
          "headers": [
            {
              "key": "Cache-Control",
              "value": "max-age=5256000"
            }
          ]
        }
      ],
      "rewrites": [
        {
          "source": "**",
          "destination": "/index.html"
        }
      ]
    }
  ]
}

and this on stg dev

 "headers": [
        {
          "source": "/**",
          "headers": [
            {
              "key": "Cache-Control",
              "value": "no-cache, no-store, must-revalidate"
            }
          ]
        },
        {
          "source": "**/*.@(jpg|jpeg|gif|png|svg|webp|js|css|eot|otf|ttf|ttc|woff|woff2|font.css)",
          "headers": [
            {
              "key": "Cache-Control",
              "value": "max-age=604800"
            }
          ]
        }
      ]

I couldn't find a way to specify what firebase.json config use when executing a firebase:deploy Is there some way to set something similar up ?

0 Answers
Related