From 19193b40f70bb706beaf2cfc2893f68aabc15a21 Mon Sep 17 00:00:00 2001 From: TobyKLight Date: Sun, 22 Sep 2024 12:21:25 +0200 Subject: [PATCH] Update cors.md -Added example error 'unexpected end of JSON' you will get from HTTPRequest op -Added devsandbox.cables.gl to suggested origins you should allow --- md/4_export_embed/cors/cors.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/md/4_export_embed/cors/cors.md b/md/4_export_embed/cors/cors.md index d8c3bbf..6ca2c6b 100644 --- a/md/4_export_embed/cors/cors.md +++ b/md/4_export_embed/cors/cors.md @@ -2,7 +2,7 @@ ## When does this happen? -Sometimes you want to access ressouces on different servers than your patch is running on, these may be +Sometimes you want to access resources on different servers than your patch is running on, these may be images, some api or any different file. Check [this patch](https://cables.gl/p/5FQ08W) for example, that loads data from an API to get the current temperature in Berlin. @@ -11,9 +11,10 @@ certain HTTP-Headers (see below). Really often this is not the case. ## How do i know this happens to me? -use this cors test to see if your headers are set correctly: https://cors-test.codehappy.dev/ +Use this cors test to see if your headers are set correctly: https://cors-test.codehappy.dev/ -First of all, you won't see the files loaded, no images, no data from the API. Check your developer tools (ctrl+shift+i or cmd+option+i) console +First of all, you won't see the files loaded, no images, no data from the API. Errors like "unexpected end of JSON". +Check your developer tools (ctrl+shift+i or cmd+option+i) console in the browser and you will, most likely, see something like this: ``` @@ -42,6 +43,7 @@ to adding this to your HTTP-Response headers: ``` Access-Control-Allow-Origin: https://cables.gl Access-Control-Allow-Origin: https://sandbox.cables.gl +Access-Control-Allow-Origin: https://devsandbox.cables.gl ``` or more broadly: