El archivo de origen: // 127.0.0.1 no está permitido por Access-Control-Allow-Origin

Im runnig an application on my localserver on a mac, this application need to connect to a server domain.com/service.php, but when I call the service(http://127.0.0.1/webpage.php) from my local page appear the following error in the console

Origin file://127.0.0.1 is not allowed by Access-Control-Allow-Origin.

some ideas about it?, on a windows local server it work perfect

gracias

preguntado el 02 de julio de 12 a las 02:07

1 Respuestas

En su webpage.php source code, you need to add this code at the very top:

<?php header('Access-Control-Allow-Origin: *'); ?>

Es a workaround for CORS (cross-origin resource sharing).

Respondido 02 Jul 12, 02:07

Hi thank,but what about an html file, is there a tag to do this on my local mac apache server - cesarlarsson

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.