Re: cors error when loading json files

More fully:

GET
XHR
http://localhost/node-arc-d3/data/johnlennon.json [HTTP/1.1 304 Not
Modified 1ms]
Headers
Response
Call Stack
ConnectionKeep-AliveDateThu, 23 Mar 2017 15:43:55
GMTEtag"dd-54b5477cab15b"Keep-Alivetimeout=5, max=92ServerApache/2.4.7
(Ubuntu)
Accept*/*Accept-Encodinggzip,
deflateAccept-Languageen-US,en;q=0.5Cache-Controlmax-age=0Connectionkeep-aliveHostlocalhostIf-Modified-SinceWed,
22 Mar 2017 16:44:02
GMTIf-None-Match"dd-54b5477cab15b"Refererhttp://localhost/node-arc-d3/User-AgentMozilla/5.0
(X11; Ubuntu; Linux x86_64; rv:51.0) Gecko/20100101
Firefox/51.0X-Requested-WithXMLHttpRequest

GET
XHR
http://json-ld.org/contexts/person.jsonld [HTTP/1.1 200 OK 292ms]
Headers
Response
Call Stack
Accept-RangesbytesAccess-Control-Allow-Origin*,
*ConnectioncloseContent-Length2444Content-Typeapplication/ld+jsonDateThu,
23 Mar 2017 15:43:38 GMTEtag"20934-98c-4d3cee5cfefa3"Last-ModifiedMon,
21 Jan 2013 16:24:39 GMTServerApache/2.2.22 (Ubuntu)
Acceptapplication/ld+json, application/jsonAccept-Encodinggzip,
deflateAccept-Languageen-US,en;q=0.5Connectionkeep-aliveHostjson-ld.orgOriginhttp://localhostRefererhttp://localhost/node-arc-d3/User-AgentMozilla/5.0
(X11; Ubuntu; Linux x86_64; rv:51.0) Gecko/20100101 Firefox/51.0
-Brent Shambaugh

GitHub: https://github.com/bshambaugh
Website: http://bshambaugh.org/
LinkedIN: https://www.linkedin.com/in/brent-shambaugh-9b91259
Skype: brent.shambaugh
Twitter: https://twitter.com/Brent_Shambaugh


On Thu, Mar 23, 2017 at 12:30 PM, Brent Shambaugh
<brent.shambaugh@gmail.com> wrote:
> FYI:
>
> The network log is more like:
>
> GET
> XHR
> http://localhost/node-arc-d3/data/johnlennon.json [HTTP/1.1 304 Not
> Modified 1ms]
> GET
> XHR
> http://json-ld.org/contexts/person.jsonld [HTTP/1.1 200 OK 292ms]
> Cross-Origin Request Blocked: The Same Origin Policy disallows reading
> the remote resource at http://json-ld.org/contexts/person.jsonld.
> (Reason: CORS header ‘Access-Control-Allow-Origin’ does not match ‘*,
> *’).  (unknown)
> TypeError: input is undefined[Learn More]  bun2-exportN3.js:418:11
>
> Thus it loads:
>
> {
>   "@context": "http://json-ld.org/contexts/person.jsonld",
>   "@id": "http://dbpedia.org/resource/John_Lennon",
>   "name": "John Lennon",
>   "born": "1940-10-09",
>   "spouse": "http://dbpedia.org/resource/Cynthia_Lennon"
> }
>
> but then it fails to load http://json-ld.org/contexts/person.jsonld
> (which exists, it just does not have a matching header for CORS)
>
> This causes the next script which needs the result to fail..
>
>
>
>
>
> -Brent Shambaugh
>
> GitHub: https://github.com/bshambaugh
> Website: http://bshambaugh.org/
> LinkedIN: https://www.linkedin.com/in/brent-shambaugh-9b91259
> Skype: brent.shambaugh
> Twitter: https://twitter.com/Brent_Shambaugh
>
>
> On Thu, Mar 23, 2017 at 12:13 PM, Brent Shambaugh
> <brent.shambaugh@gmail.com> wrote:
>> Is this quite expected with json-ld files, such as the example at json-ld.org?
>>
>> Cross-Origin Request Blocked: The Same Origin Policy disallows reading
>> the remote resource at http://json-ld.org/contexts/person.jsonld.
>> (Reason: CORS header ‘Access-Control-Allow-Origin’ does not match ‘*,
>> *’).  (unknown)
>>
>> -Brent Shambaugh
>>
>> GitHub: https://github.com/bshambaugh
>> Website: http://bshambaugh.org/
>> LinkedIN: https://www.linkedin.com/in/brent-shambaugh-9b91259
>> Skype: brent.shambaugh
>> Twitter: https://twitter.com/Brent_Shambaugh

Received on Thursday, 23 March 2017 17:33:52 UTC