Page 1 of 1

CORS issue with Firefox and fetch

Posted: 25 November 2023, 20:53
by snugglecactus
Firefox won't let me `fetch` an asset from g_gamethemeurl. See the following error:

Security Error: Content at https://studio.boardgamearena.com/1/skipto?table=533414 may not load data from https://studio.boardgamearena.com:8084/ ... /icons.svg.

I've verified the URL is valid.

Then I tried using `credentials: "include"` with the fetch call, but get this error:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at ‘https://studio.boardgamearena.com:8084/ ... /icons.svg’. (Reason: Credential is not supported if the CORS header ‘Access-Control-Allow-Origin’ is ‘*’).

This is not an issue on Chrome or Safari. Tested with Firefox 120.

Re: CORS issue with Firefox and fetch

Posted: 26 November 2023, 09:08
by Tisaac
snugglecactus wrote: 25 November 2023, 20:53 Firefox won't let me `fetch` an asset from g_gamethemeurl. See the following error:

Security Error: Content at https://studio.boardgamearena.com/1/skipto?table=533414 may not load data from https://studio.boardgamearena.com:8084/ ... /icons.svg.

I've verified the URL is valid.

Then I tried using `credentials: "include"` with the fetch call, but get this error:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at ‘https://studio.boardgamearena.com:8084/ ... /icons.svg’. (Reason: Credential is not supported if the CORS header ‘Access-Control-Allow-Origin’ is ‘*’).

This is not an issue on Chrome or Safari. Tested with Firefox 120.
What are you trying to achieve ?

Re: CORS issue with Firefox and fetch

Posted: 02 January 2024, 18:44
by snugglecactus
Sorry for the late reply. All I'm trying to do is use a `.svg` file as a sprite sheet, but the 'Content-Security-Policy' is not allowing me to load the svg file at `https://studio.boardgamearena.com:8084` when the web page is loaded from `https://studio.boardgamearena.com` (note the lack of a port number).

This issue occurs in Firefox specifically. Chrome and Safari work fine.

Re: CORS issue with Firefox and fetch

Posted: 02 January 2024, 19:44
by Tisaac
snugglecactus wrote: 02 January 2024, 18:44 Sorry for the late reply. All I'm trying to do is use a `.svg` file as a sprite sheet, but the 'Content-Security-Policy' is not allowing me to load the svg file at `https://studio.boardgamearena.com:8084` when the web page is loaded from `https://studio.boardgamearena.com` (note the lack of a port number).

This issue occurs in Firefox specifically. Chrome and Safari work fine.
Then i am afraid you wont be able to do it that way. Only way to access svg content is to embed it directly inside the tpl (or create it from je by having ite content in a js file)