2016-07-22 26 views
1

Ich versuche, die cleanUrls Option zu verwenden, .html in Routen zu löschen. Funktioniert gut lokal mit firebase serve. Aber sobald es zu stossen eingesetzt wird, ist .html erforderlich.Firebase Hosting cleanUrls funktioniert nicht in der Produktion

Meine Testort: ​​https://maptennis.firebaseapp.com/ Klicken Sie auf Anmeldung finden Sie auf /login fahren und gibt einen 404. Anfügen .html an die URL und es wird funktionieren.

Meine firebase.json Konfigurationsdatei: { "database": { "rules": "database.rules.json" }, "hosting": { "public": "public" }, "cleanUrls": true, "trailingSlash": false }

Einsicht hier wäre toll.

Antwort

1

Ich war mit einem ähnlichen Problem konfrontiert. Meine firebase.json Datei sah wie folgt aus:

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

Ich bemerkte, war ich mit einer älteren Version von Firebase CLI. Als ich auf die neueste Version aktualisiert und versuchte, mit gleicher Konfigurationsdatei zu implementieren, trat folgende Fehlermeldung:

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.

ich meine Json Config-Datei dies geändert:

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

Deploy war erfolgreich und cleanUrls arbeitete diese Zeit :)