Unexpected trailing slash behaviour with Firebase hosting
<p>I'm seeing unexpected behaviour (at least as per me) with trailing slashes on Firebase Hosting. I expect Firebase to serve URLs with a trailing slash (except for actual files present in the hosting directory). For this I set <code>trailingSlash</code> to <code>true</code> in firebase.json.</p>

<p>This resulted in:</p>

<pre><code>example.com                     redirect to     example.com/index.html/
example.com/js/script.js        redirect to     example.com/js/script.js/
example.com/images/image.png    redirect to     example.com/images/image.png/
</code></pre>

<p>The expected behaviour would be:</p>

<pre><code>example.com                     redirect to example.com/
example.com/js/script.js        served as it is without any redirect
example.com/images/image.png    served as it is without any redirect
</code></pre>

<p>The addition of trailing slash to actual file URLs makes the browser/server think <code>script.js</code> is a directory instead of file and results in a 404. The addition of index.html to the root simply isn't elegant.</p>

<p>Expecting <code>cleanUrls</code> to do the trick I set <code>cleanUrls</code> to <code>true</code> along with <code>trailingSlash</code> and immediately the site goes into an endless redirect loop and fails to load. How can I stop Firebase from adding "index.html" at the root and the trailing slash for the actual js or image assets?</p>

<p>Edit:</p>

<p>As requested by Frank here's the firebase.json I'm using:</p>

<pre><code>{
    "firebase"          : "example",
    "public"            : "public",
    "cleanUrls"         : false,
    "trailingSlash"     : true,
    "ignore"            : [ "firebase.json", "**/.*", "**/node_modules/**" ],
    "rewrites": [{

        "source"        : "**",
        "destination"   : "/index.html"

    }],
    "headers": [{

        "source"    : "**/*.@(eot|otf|ttf|ttc|woff|font.css)",
        "headers"   : [{

            "key"   : "Access-Control-Allow-Origin",
            "value" : "*"
        }]

    }, {

        "source"    : "**/*.@(jpg|jpeg|gif|png)",
        "headers"   : [{
            "key"   : "Cache-Control",
            "value" : "max-age=600"
        }]

    }, {

        "source"    : "**/*.@(html|js)",
        "headers"   : [{
            "key"   : "Cache-Control",
            "value" : "max-age=300"
        }]

    }]
}
</code></pre>

<p>P.S.: I have tried setting both <code>trailingSlash</code> and <code>cleanUrls</code> to <code>true</code> and also tried setting these <code>true/false</code> individually.</p>