Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase Hosting mime type

Has anyone found a way to set the mime type returned in the Content-Type header when hosting a file using Firebase Hosting? The docs say they support some headers in their rules file but not the content-type and I tied it anyway but fails the 'firebase deploy' due to error 'hosting.headers[0].headers[0].key is not one of enum values'. Also, the file i need to serve cannot have an extension which makes things harder for firebase to auto discover the type of the file.

like image 744
Alex Avatar asked Jun 09 '16 13:06

Alex


1 Answers

I tested this and it seems to work. Also for your second issue why not set an extension anyways but change it to the mimetype you need?

{
  "database": {
    "rules": "database.rules.json"
  },
  "hosting": {
    "public": "public",    
    "rewrites": [
      {
        "source": "**",
        "destination": "/index.html"
      }
    ],
    "headers": [
      {
        "source": "**/*.@(datagz|memgz|mem|data)",
        "headers": [
          {
            "key": "Content-Type",
            "value": "application/octet-stream"
          }
        ]
      } 
    ]
  }
}
like image 185
fassetar Avatar answered Nov 02 '22 22:11

fassetar