GitHub pages hosting .pmtiles not always working? (Chrome/Firefox)
Discussed in https://github.com/protomaps/PMTiles/discussions/582
Originally posted by jamaps June 15, 2025 Hi y'all
I've been using GitHub pages to host smaller .pmtiles (<50mb or so) for the past few months (and mostly loading and styling them in maplibre). Has been working great!
But recently I'm seeing that .pmtiles files hosted via Github pages are sometimes not loading and returning errors like this in my web browser:
-
In Chrome,
Error: Server returned no content-length header or content-length exceeding request. Check that your storage backend supports HTTP Byte Serving. -
In Firefox,
"Decoding failed."
My projects still work perfectly fine when testing locally and loading local files, or when loading .pmtiles coming from anywhere else other than a GitHub repo.
Anyone know if GitHub pages has changed how they serve .pmtiles or similar files that rely on range requests? or have any other ideas?
(Noticing as well that Chrome seems to not error as much compared to Firefox, but I don't really understand why there would a browser difference).
Thanks!
~ Jeff
This is the line that fails:
https://github.com/protomaps/PMTiles/blob/main/js/src/index.ts#L460
Something changed in the GitHub Pages HTTP implementation related to Content-Encoding
https://github.com/orgs/community/discussions/162857 may also be related
Here is my current understanding of the problem:
Firefox is unique in that it sends the following HTTP header along with Range:
Accept-Encoding: gzip, deflate, br, zstd, identity
Other browsers such as Safari and Chrome only send Accept-Encoding: identity.
Something recently changed in GitHub Page's Fastly CDN configuration meaning that the server responds with an Content-Encoding: gzip on 206 responses if gzip is present in Accept-Encoding. This means no PMTiles hosted on GitHub Pages will work in Firefox.
Because we cannot control Accept-Encoding in the client, the only fix I see is to prove that the new GitHub pages behavior is incorrect. I think the best approach may to be make a very minimal reproduction of the problem using raw fetch requests and no PMTiles at all.
I have created an independent reproduction of the issue here:
https://github.com/bdon/ghpages-firefox-range-bug
@jamaps
Great to see this issue, here's a larger reproducible example: https://pctni.github.io/uitest/
Result on Firefox (with debugging FYI):
On Chrome, all fine:
Will try deploying on Netlify.
When served by netlify the same codebase renders fine on Firefox: https://pctnitest.netlify.app/
@Robinlovelace @jamaps a temporary workaround to fix on Firefox is to rename .pmtiles to .pmtiles.gz. That will stop GitHub Pages from applying automatic compression.
In this long term I am hoping to get this merged into the MIME type database Pages uses, which ought to fix the problem: https://github.com/jshttp/mime-db/pull/398/files
@bdon thank you! the workaround is working for me - hopefully that PR gets merged in soon