-
Hello, Does your Pages site has its visibility set to private? Pages allows CORS ( This is the current (sensitive) behavior in place until we can support custom headers. |
Beta Was this translation helpful? Give feedback.
-
No the site is public. |
Beta Was this translation helpful? Give feedback.
-
Only thing I can think of is extra restrictions your browser would put on. Say if |
Beta Was this translation helpful? Give feedback.
-
The server VM is local but within the code on github, it points to my ISP allocated IP address and the port forwarding gets it to the VM. |
Beta Was this translation helpful? Give feedback.
-
I have added “mode” (cors) to the fetch request along with a header of “Access-Control-Allow-Origin” (the IP address of my ISP connection).
Now this is the first time I have had a reason that mentioned Access-Control-Allow-Origin. It is also the first time that I specifically added Access-Control-Allow-Origin to the headers in the fetch request. Which is all very confusing. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
@airtower-luna, thank you for this. |
Beta Was this translation helpful? Give feedback.
-
So I solved this. Nothing to do with github pages or svelte. |
Beta Was this translation helpful? Give feedback.
-
Can you be more precise about how you solved this problem |
Beta Was this translation helpful? Give feedback.
-
Hello @Sam-cudo, I have two entries for CORS because the frontend code is either running on a local svelte server (localhost/PC) or on github. I hope this helps. The key thing for me was realising that the backend had to know where to expect requests to come from; in my case either github.io or my local svelte server (or apache or nginx or whatever) |
Beta Was this translation helpful? Give feedback.
-
Hello,
my set up is an app on github pages (GH) that calls a local rest api server to get data.
I can access the data from outside my office network via curl. The data is behind https.
But when the page from github pages tries to access the data, the browser console shows
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://xx.xx.xx.xx:3000/users/login. (Reason: CORS request did not succeed).
The server has CORS enabled (it is the loopback 4 framework that has CORS enabled by default). Is there anything I need to do in the app under GH?
Beta Was this translation helpful? Give feedback.
So I solved this. Nothing to do with github pages or svelte.
I was using the cors origin value in the rest server as the url of the server. It needs to be the github.io url.