Skip to content

GitHub pages hosting .pmtiles not always working? (Chrome/Firefox) #584

Closed
protomaps/docs
#133

Description

@bdon

Discussed in #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

Activity

  1. bdon commented on Jul 1, 2025

    @bdon
    MemberAuthor

    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

  2. bdon commented on Jul 1, 2025

    @bdon
    MemberAuthor
  3. bdon commented on Jul 8, 2025

    @bdon
    MemberAuthor

    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.

  4. bdon commented on Jul 9, 2025

    @bdon
    MemberAuthor

    I have created an independent reproduction of the issue here:

    https://github.com/bdon/ghpages-firefox-range-bug

    @jamaps

  5. Robinlovelace commented on Jul 29, 2025

    @Robinlovelace

    Great to see this issue, here's a larger reproducible example: https://pctni.github.io/uitest/

    Result on Firefox (with debugging FYI):

    Image

    On Chrome, all fine:

    Image
  6. Robinlovelace commented on Jul 29, 2025

    @Robinlovelace

    Will try deploying on Netlify.

  7. Robinlovelace commented on Jul 29, 2025

    @Robinlovelace

    When served by netlify the same codebase renders fine on Firefox: https://pctnitest.netlify.app/

  8. bdon commented on Aug 4, 2025

    @bdon
    MemberAuthor

    @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

  9. jamaps commented on Aug 13, 2025

    @jamaps

    @bdon thank you! the workaround is working for me - hopefully that PR gets merged in soon

  10. bdon commented on Mar 13, 2026

    @bdon
    MemberAuthor

    From testing https://bdon.github.io/ghpages-firefox-range-bug/ this issue has been fixed recently in GitHub Pages, so a .pmtiles.gzworkaround is no longer needed. If others can confirm their existing repos are fixed, I'll close out this issue.

  11. added a commit that references this issue on Jul 23, 2026
  12. added a commit that references this issue on Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions