Hey guys , i've buiding one kmp app for all platfo...
# multiplatform
m
Hey guys , i've buiding one kmp app for all platform its works fine in all expect web , I used js for web , I was using compose image loader to load images from network . It is showing error in console Access to fetch at '

https://apod.nasa.gov/apod/image/2405/NGC2169LRGBQHY183HR_c1024.jpg

' from origin 'http://localhost:8080' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled. This error is there only for web platform. can anyone help?
c
This is the server declaring that they refuse requests from localhost, and your browser is honoring this refusal. There is nothing you can do about it. https://aws.amazon.com/what-is/cross-origin-resource-sharing
CORS is an in-browser feature to protect users from attacks in which an attacker is able to execute code on their machine that tries to imitate a website. It doesn't exist in non-browser environments, which is why it only fails on the web platform.
m
Hi, I've just faced the same issue. Since web app runs on local web server, which is launched via
wasmJsBrowserRun
gradle task, I wonder how to update its configuration to allow CORS?
c
Ask in #CDFP59223, but you'll need to provide more info (what resource are you trying to access? which technology is hosting it?)