Web build - serves index.offline.html instead of index.html

Godot Version

4.4

Question

I have a PWA web build of my game. On iOS, I am able to load my game in browser and then save it to my home screen. It works fine when I first do this, but if I exit the app and reload, it loads the index.offline.html file instead of the index.html file, and I’m unable to get it working again without deleting and re-installing the app.

This seems likely to be some issue with the service worker which seems to serve the index.offline.html if it things the app is offline. Any help in diagnosing / fixing this would be much appreciated.

1 Like

This seems to have been caused by my web server issuing 301 redirects for index.html files which the Godot service worker did not like.

More specifically, I am using Go web server using http.FileServer to serve static files. The default behavior is to redirect index.html to the respective containing / route. I was able to switch to a custom haneler using http.ServeContent for index.html files.

An open Golang issue can be found here:

This doesn’t seem to be an issue with the Godot web build as far as I can tell (unless there’s a way to to have it handle 301 redirects).