Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

HTML/ JS (React) Game returns 403 Errors

A topic by thathurtabit created Jun 27, 2020 Views: 725 Replies: 5
Viewing posts 1 to 5
(1 edit) (+1)

Hi. I'm having problems uploading my static HTML/React Games.

I choose Kind of Project: HTML and upload a .zip of the following structure:

.zip:
    index.html
        static/
            chunk.js
            chunk.js
            style.css
            etc.

But Itch returns 403 on the static folder assets.

See here: https://thathurtabit.itch.io/doop

NOTE: I eventually got this "working" by setting my "homepage" value in package.json to be "." (i.e. just a dot) then changed by react-router to redirect any values to my game page - this meant even if it didn't understand the itch.io url, it would display the game.

(1 edit)

Looks like your game is requesting v6p9d9t4.ssl.hwcdn.net/static/js/2.b1595f88.chunk.js when the file you want is actually at v6p9d9t4.ssl.hwcdn.net/html/2414319/static/js/2.b1595f88.chunk.js . My guess is that in your app you have it as an absolute path (/static/js/...). Try removing the first slash so it's just static/js/...

Hi thanks for your reply. This issue seems to be talked about here in Create React App: https://github.com/facebook/create-react-app/issues/1094

Doesn't look like there's any way to run a React game with React Router, built with CRA on Itch.io which is a shame. Changing the asset URLs then breaks page routing, and leaving the asset URLs as is returns 403 errors.

Is there  away just pull in an iframe of the game instead? It exists on their own pages, and could just be pulled in via an iframe (rather than uploaded and then pulled in via iframe)

(1 edit) (+1)

Hey there, just another React Idle dev chiming in with a solution for you!

Using github pages to host the project, and then uploading just a simple html file with an iframe to the github page works for me, at least in the draft stage so for! Hopefully it works when published and works for you too. Good luck. It was your comment that gave me the idea, and it was easy enough to implement. So thanks too, haha.

I solved this issue by doing "npm run build" and then manually changing the paths in the resulting build folder to be relative. I had   "homepage" : "/REMOVETHIS" in my package.json. Then, after doing npm run build,  I went through all of the files in the build folder and removed all instances of "/REMOVETHIS/" (note the slashes on both sides). Then it works. 

This topic has been auto-archived and can no longer be posted in because there haven't been any posts in a while.