You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@zeppelin.apache.org by afancy <gr...@gmail.com> on 2016/10/28 07:14:34 UTC

No 'Access-Control-Allow-Origin' header

Hi all,

I get json in the angular environment, but got
the 'Access-Control-Allow-Origin' exception. See the following.
How to solve this issue? Thanks for your advice!

/afancy

%angular
<script type="text/javascript">
 readJson = function (url) {
    $.getJSON(url, function(data){
         console.log(data.body);
    });
 }

readJson('
http://129.241.107.186:4242/api/query/last?timeseries=ctt.traffic.JF&resolve=true'
);
</script>


XMLHttpRequest cannot load
http://129.241.107.186:4242/api/query/last?timeseries=ctt.traffic.JF&resolve=true.
No 'Access-Control-Allow-Origin' header is present on the requested
resource. Origin 'http://localhost:8080' is therefore not allowed access.

Re: No 'Access-Control-Allow-Origin' header

Posted by Park Hoon <1a...@gmail.com>.
Hi afancy,


Webservers (e.g nginx, apache, spring and so on) basically do not allow
AJAX requests from other origin (host + ip).

(See https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS)

If you want your webserver to respond requests from other origin, you
should set proper options in the webserver.

You can refer this site: http://enable-cors.org/index.html


Thanks :)

On Fri, Oct 28, 2016 at 4:14 PM, afancy <gr...@gmail.com> wrote:

> Hi all,
>
> I get json in the angular environment, but got the 'Access-Control-Allow-Origin'
> exception. See the following.
> How to solve this issue? Thanks for your advice!
>
> /afancy
>
> %angular
> <script type="text/javascript">
>  readJson = function (url) {
>     $.getJSON(url, function(data){
>          console.log(data.body);
>     });
>  }
>
> readJson('http://129.241.107.186:4242/api/query/last?
> timeseries=ctt.traffic.JF&resolve=true');
> </script>
>
>
> XMLHttpRequest cannot load http://129.241.107.186:4242/
> api/query/last?timeseries=ctt.traffic.JF&resolve=true. No
> 'Access-Control-Allow-Origin' header is present on the requested resource.
> Origin 'http://localhost:8080' is therefore not allowed access.
>