设置Last-Modified标头时“格式错误的'标题'条目”

时间:2014-08-28 16:41:50

标签: json firebase firebase-hosting

我尝试为我的资源设置Last-Modified标头,以便可以正确缓存它们。但是,当我运行firebase deploy时,我收到以下错误:

FIREBASE WARNING: set at /hosting/headers/dstaley failed: permission_denied
Settings Error - Incorrectly formatted "headers" entry in the firebase.json

我的firebase.json如下:

{
  "firebase": "dstaley",
  "public": "dist",
  "ignore": [
    "firebase.json",
    "**/.*",
    "**/node_modules/**"
  ],
  "rewrites": [
    {
      "source": "**",
      "destination": "/index.html"
    }
  ],
  "headers": [
    {
      "source": "**/*.@(js|css)",
      "headers": [
        {
          "key": "Cache-Control",
          "value": "max-age=31536000"
        }
      ]
    },
    {
      "source": "**/*.@(js|css|html)",
      "headers": [
        {
          "key": "Last-Modified",
          "value": "Thu, 28 Aug 2014 16:25:05 GMT"
        }
      ]
    }
  ]
}

该文件看起来格式正确,permission_denied错误导致我认为无法使用Firebase托管设置Last-Modified标头。有什么想法吗?

1 个答案:

答案 0 :(得分:2)

正如in the documentation所说:

  

我们目前只支持Cache-Control和   Access-Control-Allow-Origin标头作为密钥。

所以不,你不能(目前)那样做。