2016-07-22 67 views
1

我正在嘗試使用cleanUrls選項在路由中刪除.htmlfirebase serve在本地很好地工作。但是一旦部署到產品,需要.htmlFirebase託管cleanUrls無法在生產中工作

我的測試網站:https://maptennis.firebaseapp.com/ 點擊登錄會開車送你到/login,並給出了404追加.html的URL,它會工作。

我firebase.json配置文件: { "database": { "rules": "database.rules.json" }, "hosting": { "public": "public" }, "cleanUrls": true, "trailingSlash": false }

這裏任何有識之士將是巨大的。

回答

1

我正面臨類似的問題。我firebase.json文件是這樣的:

{ 
    "hosting": { 
    "public": "public" 
    }, 
    "cleanUrls": true 
} 

我發現我是用火力地堡CLI的舊版本。當我更新到最新版本,並試圖用相同的配置文件部署,出現以下錯誤:

hosting: We found a hosting key inside firebase.json as well as hosting configuration keys that are not nested inside the hosting key.

Please run firebase tools:migrate to fix this issue. Please note that this will overwrite any configuration keys nested inside the hosting key with configuration keys at the root level of firebase.json.

Error: Hosting key and legacy hosting keys are both present in firebase.json.

我改變了我的JSON配置文件到這一點:

{ 
    "hosting": { 
    "public": "public", 
    "cleanUrls": true 
    } 
} 

部署是成功的,cleanUrls工作這時間:)