- Home /
My WEBGL game is encountering issues with CORS but not other games?
For context, when my colleagues attempt to test the game on an AWS server, it encounters a "No 'Access-Control-Allow-Origin' header is present on the requested resource. From all of my research so far, it seems to be a server issue, as it happens when the server does not have a CORS configuration. However, My colleague also said that previous games made by former colleagues are able to work fine.
Are there things that can be done on the game's end to prevent a CORS issue? I am using 2020.3.3f1
Answer by sgtpendulum · Dec 09, 2021 at 07:56 AM
Okay, so the solution for my situation specifically is to DISABLE COMPRESSION AND DECOMPRESSION FALLBACK ENTIRELY. That can't be it. Why would it cause a CORS issue?
Well, if that's really the case, the CORS error may be just a side effect of some fallback behaviour. Have you seen the actual log of the website with that issue? What exact resource was causing the CORS error?
It was the data.unityweb file that caused that issue.
Answer by Bunny83 · Dec 09, 2021 at 07:54 AM
That's not enough information. Where is your game hosted? Most likely not on the same server you are trying to connect to, right? In that case the server you try to connect to has to explicitly allow access from a foreign domain. This is a security measure of browsers. A website is not allowed to load resources from foreign domains unless that server allows such requests. There is nothing you can do about that besidse: Hosting your game and whatever backend service you try to access on the same server, or make sure the backend server allows access from your other domain. You can not break out of the security sandbox of the browser, you have to be let out.