Wasim
Wasim

Reputation: 5113

AS3 Error on URLRequest in Flash with HTTPS url with self signed certificate

I'm using Actionscript 3 and loading a URL that returns JSON data. It works fine when requesting from an HTTP URL, but when I use an HTTPS URL I get a IOErrorEvent.IO_ERROR error. But I only get the error when testing the application in Flash - when the application is embedded it works absolutely fine.

data_request_string = "https://someurl.json";
dataRequest = new URLRequest(data_request_string);
dataLoader = new URLLoader();
dataRequest.method = URLRequestMethod.POST;
dataLoader.addEventListener(Event.COMPLETE, dataLoaderHandler);
dataLoader.addEventListener(IOErrorEvent.IO_ERROR, dataLoaderHandler);
dataLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, dataLoaderHandler);
dataLoader.addEventListener(HTTPStatusEvent.HTTP_STATUS, dataLoaderHandler);
dataLoader.load(dataRequest);

This is the error that's returned

[IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032: Stream Error. URL: https://someurl.json"]

UPDATE

I think I have narrowed it down to the fact I'm using a self signed certificate on a local machine. When I access the same URL on the site domain with a signed certificate, there's no such issues. How can I get around this?

Upvotes: 0

Views: 747

Answers (1)

Wasim
Wasim

Reputation: 5113

Problem solved! I added the self signed certificate to my keychain on the Mac and set it to Always Trust. This worked a treat.

Upvotes: 1

Related Questions