+ Start a Discussion
Callidus CloudCallidus Cloud 

Cross-Origin Request errors while referencing static resource in lightning component

I unable load my lightning component in a ligtning app page due to Cross-Origin Request error . I'm getting below mentioned error in the console

   Font from origin 'https://xxx-dev-ed.my.salesforce.com' has been blocked from loading by Cross-Origin Resource Sharing policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://xxx-dev-ed.lightning.force.com' is therefore not allowed access. The response had HTTP status code 404. 

So can any one please suggest me the right answer to fix this issue..
 
Balasubramaniam 07Balasubramaniam 07
Hi
Please post how you are referring it in lightning.
Thanks
Moxesh Shah 13Moxesh Shah 13
i have also same problem 
i refer as below......
 
<ltng:require styles="/resource/bootstrapcss,/resource/font" scripts='/resource/jqury,/resource/boostrapjs'/>
LinvioIncLinvioInc
We have the same issue with a lightning component we are exposing in flow designer. 
 
<ltng:require styles="" 
                  scripts="{!join(',','/resource/evt__JQuery/jquery-3.2.1.min.js',$Resource.EventManagement + '/moment/moment.js',$Resource.TimezonePicker+'/timezone-picker.js')}" 
				  afterScriptsLoaded="{!c.afterJSLoaded}" />


The script uses ltng:require to include javascript in a static resource, we've CORS whitelisted https://*.force.com and https://*.salesforce.com, but still get the error: 

Failed to load https://linvioevents-dev-ed.my.salesforce.com/visualforce/session?url=https%3A%2F%2Flinvioevents-dev-ed--evt.na7.visual.force.com%2Fresource%2Fevt__JQuery%2Fjquery-3.2.1.min.js: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.

We've been scouring the forums but haven't seen anything that addresses this issue.

Thanks