On Thu, Apr 4, 2019 at 12:03 PM Pierre-Antoine Champin <
pierre-antoine.champin@univ-lyon1.fr> wrote:
> The only URL that works for me in the playground is "http://schema.org",
> and this is indeed because it does *not* query the original URL, but
> instead:
> https://json-ld.org/playground/proxy.php?url=http://schema.org
>
> For any other variant, the original URL is requested,
> and the console displays a Cross-Origin Request error message on the 2nd
> request
> (i.e. after the succesful redirection).
>
> This is *definitely* related to the fact that
> https://schema.org/docs/jsonldcontext.json
> is missing the header
> access-control-allow-origin: *
>
>
To clarify some of the odd playground behavior, there is a hack in there
[1] to handle "http://schema.org/" (with the trailing slash). It will
rewrite to https to avoid mixed security issues. Any other urls that are
not https will use the proxy, including "http://schema.org" (w/o the
trailing slash). That code should really change all schema.org urls to
https. An oversight that it didn't do that before, but at the moment a fix
would break the version w/o trailing slash. It does appear that when not
using the proxy it's just a CORS issue. It would be nice to fallback to
the proxy if CORS fails, but I don't think there is a way to detect that is
the cause of a failure.
[1]
https://github.com/json-ld/json-ld.org/blob/master/playground/playground.js#L1498
-dave