json-ld / json-ld.org

JSON for Linked Data's documentation and playground site
https://json-ld.org/
Other
858 stars 152 forks source link

Improve playground proxy and/or playground document loader #813

Open davidlehn opened 1 year ago

davidlehn commented 1 year ago

The playground has a proxy to help load HTTP contexts from the HTTPS playground: https://github.com/json-ld/json-ld.org/blob/main/playground/proxy.php

There are some issues with this:

Ideally the proxy would not be needed, but if the playground is to be HTTPS, then a workaround to load HTTP resources is needed.

I think the longer term fixes that are needed are:

See also: https://github.com/json-ld/json-ld.org/issues/798

davidlehn commented 1 year ago

Note to future self:

gkellogg commented 1 year ago

I think you can probably white-list the proxy to only work with schema.org and that will handle 99% of cases involving redirection or HTTP headers. Of course, it's good practice to handle common requests locally to avoid web traffic, but that requires some mechanism to keep the local versions up to date. But, IIRC jsonld.js has a way to use a local cache of loaded contexts.

davidlehn commented 1 year ago

The playground rewrites schema.org specifically to always be https, so the proxy isn't even used for that. (At least not for the common base domain URL use case).