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 https://mycarexchange-developer-edition.na53.force.com/s/, 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 'https://mycarexchange-developer-edition.na53.force.com/resource/1534109270000/Leaflet/leaflet.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled. VM40579:1

GET https://mycarexchange-developer-edition.na53.force.com/resource/1534109270000/Leaflet/leaflet-src.js 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.

  • what about permissions to your static resource? set it's Cache Control to Public Aug 15, 2018 at 7:18
  • @ItaiShmida That did the trick. Thank you. Can you submit as an answer so I can mark this question as 'answered'? Aug 16, 2018 at 1:57
  • Also, I've found that quitting and reopening chrome sometimes solves this issue, especially when hosting components in communities. Seems like there's caching going on that causes sporadic issues with loading static resources. Aug 18, 2018 at 6:28

2 Answers 2


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

enter image description here


Too late for the party, but if anyone is willing how to set this config automatically, you can do this by setting the cacheControl property on *.resource-meta.xml

<?xml version="1.0" encoding="UTF-8"?>
<StaticResource xmlns="http://soap.sforce.com/2006/04/metadata">

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .