- Home /
http request over an https webgl
Hi, I am having an issue using a WWW call to load an image over the internet. Here is a sample of my code :
WWW www = new WWW(url);
yield return www;
var sprite = Sprite.Create(www.texture, new Rect(0, 0, www.texture.width, www.texture.height), new Vector2(0, 0), 100.0f);
m_Icon.sprite = sprite;
And here is the error I am getting when running it in webgl : Mixed Content: The page at 'https://apps.facebook.com/gameaddress' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://m.sarbakan.com/assetName.png'. This request has been blocked; the content must be served over HTTPS.
When I run my code in editor, it works fine. So my question is, can I call an http request over an https. Cause my game is on facebook, which require an https connection to speak with my server, but I want my assets to be somewhere else and using an http connection.
So can I do it and how?
Have you tried setting the protocol in your url to https:// to see what happens?
Answer by urkle · Feb 20, 2015 at 01:58 AM
You can't access non-secure content from a secure page. It's baked into the browser security. So you need to use https, also you will probably need to setup CORS on your server to allow requests from the facebook domain.
Your answer
Follow this Question
Related Questions
Unity WWW Warning Message in Xcode 1 Answer
WWW.uploadProgress doesn't work on iOS 0 Answers
How to validate SSL certificate before sending data via https? 1 Answer
WWW not working with https in iOS builds 1 Answer
Loaclization in WebGL? 1 Answer