- Home /
Github Pages with WebGL - JSON error
So I'm trying to host some demo WebGL projects using Github Pages. So far I've created a project, uploaded index.html alongside the Build and TemplateData folders, and added a web.config file next to index.html with the following contents:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension=".mem" mimeType="application/octet-stream" />
<mimeMap fileExtension=".data" mimeType="application/octet-stream" />
<mimeMap fileExtension=".unity3d" mimeType="application/octet-stream" />
<mimeMap fileExtension=".memgz" mimeType="application/octet-stream" />
<mimeMap fileExtension=".datagz" mimeType="application/octet-stream" />
<mimeMap fileExtension=".unity3dgz" mimeType="application/octet-stream" />
<mimeMap fileExtension=".jsgz" mimeType="application/octet-stream" />
<mimeMap fileExtension=".unityweb" mimeType="application/octet-stream" />
<mimeMap fileExtension=".json" mimeType="application/json" />
</staticContent>
</system.webServer>
</configuration>
However, on loading the project, I still get this error:
An error occurred running the Unity content on this page. See your browser JavaScript console for more info. The error was:
SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
Try as I might, I can't seem to find a way around this. Does anyone here know what is wrong?
I don't have the money to spend on hosting, so Github Pages is really my only option (I tried Azure, but it has a very tight bandwidth limit that I went over almost immediately), unless anyone knows of any other free web hosts.
Answer by Newtori · Mar 12, 2018 at 02:11 AM
I had the exactly same issue and i fixed it, building my game with Brotli compression Format (Inside Publishing Settings for Webgl in unity), instead of Gzip. Then you have to put this web.config for GitHub web host: You will not need to pay for amazon or azure server :)
<system.webServer>
<staticContent>
<remove fileExtension=".unityweb" />
<mimeMap fileExtension=".unityweb" mimeType="application/octet-stream" />
</staticContent>
<rewrite>
<outboundRules>
<rule name="Append br Content-Encoding header">
<match serverVariable="RESPONSE_Content-Encoding" pattern=".*" />
<conditions>
<add input="{REQUEST_FILENAME}" pattern="\.unityweb$" />
</conditions>
<action type="Rewrite" value="br" />
</rule>
</outboundRules>
</rewrite>
</system.webServer>
Your answer
![](https://koobas.hobune.stream/wayback/20220612143900im_/https://answers.unity.com/themes/thub/images/avi.jpg)