Load image from web ioerror

I’m trying to upload an image from the web. I try locally and from the site, and always get a response:
[IOErrorEvent type=“ioError” bubbles=true cancelable=false text="" errorID=0]

Code here:

private function loadImage():Void
{
	_loader = new Loader();
	_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadCompleteHandler);
	_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);

	/* way 1 */
	//var context:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain, SecurityDomain.currentDomain);
	//_loader.load(new URLRequest("https://randomuser.me/api/portraits/men/79.jpg"), context);

	/* way 2 */
	_loader.load(new URLRequest("https://randomuser.me/api/portraits/men/79.jpg"));
}

private function loadCompleteHandler(event:Event):Void 
{
	trace("load complete");
}
	
private function ioErrorHandler(event:IOErrorEvent):Void 
{
	trace("load fail");
	trace(event.toString());
}

What’s wrong?

I found many errors using the Loader class as well on targets other than Flash, so I started using the URLLoader instead:

_loader = new URLLoader();
_loader.dataFormat = URLLoaderDataFormat.BINARY;
_loader.addEventListener(Event.COMPLETE, onLoaderComplete);
_loader.addEventListener(IOErrorEvent.IO_ERROR, onLoaderIoError);
_loader.load(new URLRequest('picurl'));

private function onLoaderComplete(evt:Event):Void
{
    _graphic = new Bitmap();
    #if lime_legacy
        this._graphic.bitmapData = BitmapData.loadFromBytes(_loader.data);
    #else
        this._graphic.bitmapData = BitmapData.fromBytes(_loader.data);
    #end
}

No, this does not work, the same result.
You can check it in console log in the browser here:
https://boris-yurkov.snpdev.ru/test/index.html

I try load image with url https://randomuser.me/api/portraits/men/79.jpg and it print:

Main.hx:113: load fail quiz2.js:7600:3
Main.hx:114: [IOErrorEvent type=“ioError” bubbles=true cancelable=false text="" errorID=0]

I tried HTML5, and got this output:

Redirect from ‘http://randomuser.me/api/portraits/men/79.jpg’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘http://localhost:3000’ is therefore not allowed access.

Perhaps the server needs access control origin headers, or you could try an HTTP address?

Can you please explain more? What do you think needs to be done?

I think the server needs to respond with the correct headers, or it needs to be requested from the same site