3

I'm writing a packed app for Firefox OS. I want to communicate with an external server via https. If I execute the app as normal website it is running but in Firefox OS or the simulator I receive

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://mozilla.goip.de/Webradio%20V2/php/download_streams.php. This can be fixed by moving the resource to the same domain or enabling CORS.

without "systemXHR" : {} and "type": "privileged" in the manifest and { mozSystem: true } in req = new XMLHttpRequest({ mozSystem: true });. Using this my server still only receives an request only using http. With https the server receives no request and the status of the request is 0. The server already allows access by header('Access-Control-Allow-Origin: *'); (PHP).

Is there any way to use https for the connection?

sideshowbarker
  • 81,827
  • 26
  • 193
  • 197
thz
  • 111
  • 8
  • Are you certain that the https server is sending out the `Access-Control-Allow-Origin: *` header too? (And not just the http server.) I don’t know how this is configured in the PHP setup you’re using, but in the case of directly configuring a Web server for CORS, you’d generally need to configure it separately for for the https server. They’re two separate origins, with different characteristics. – sideshowbarker Sep 28 '15 at 18:14
  • both VirtualHost (apache) run exactly the same PHP-script. Without `header('Access-Control-Allow-Origin: *');` it fails as a normal website using https, too. With this line it works quit fine. – thz Sep 28 '15 at 22:21
  • I've connceted the server for the app locally (http / https) while the XMLHttpRequest (https) runs over the internet. So i've the same conditions. – thz Sep 28 '15 at 22:38

0 Answers0