Static Resources not found by Customer Community Lightning Component

Static resources aren’t loading when my Lightning Component is hosted on a Customer Community page. They do load in-app, so I’m guessing there’s a namespace issue with my resource paths when I use the component in Community.

On page load the following resources fail to load in the live community site, whose url is, but do load in-app as well as in Community Builder Preview.

<ltng:require styles="{!$Resource.Leaflet +'/leaflet.css'}" 
              scripts="{!$Resource.Leaflet +'/leaflet-src.js'}"
              afterScriptsLoaded="{!c.jsLoaded}" />

The errors were,

Refused to apply style from ‘‘ because its MIME type (‘text/html’) is not a supported stylesheet MIME type, and strict MIME checking is enabled.

GET 404 (Not Found)

The Leaflet folder structure is as follows (image is the only folder in this zip, the rest are files)
—-image files

Unfortunately I’m having this same issue with most of my static resources; I didn’t include all examples for brevity, but will do so if it’s helpful.


You need to set the static resource Cache Control as Public:

enter image description here

Source : Link , Question Author : Nicholas Zozaya , Answer Author : Itai Shmida

Leave a Comment