Skip to content

fix(maps): transformRequest proxies ALL OFM requests through /ofm/ - #178

Merged
slaveofcode merged 1 commit into
developfrom
fix/map-transform-request
Aug 8, 2026
Merged

fix(maps): transformRequest proxies ALL OFM requests through /ofm/#178
slaveofcode merged 1 commit into
developfrom
fix/map-transform-request

Conversation

@slaveofcode

Copy link
Copy Markdown
Owner

Root cause (confirmed via Network tab)

Only ne2_shaded PNG raster tiles appear in the Network tab — zero PBF tile requests. fetchResolvedStyle rewrites the style object, but when it leaves a url field on the openmaptiles vector source (TileJSON fetch failure fallback), MapLibre does its own TileJSON fetch and gets tile URLs pointing directly to tiles.openfreemap.org — bypassing our proxy and hitting the broken Singapore CDN edge.

Fix

Add transformRequest to the MapLibre map instance. This intercepts every network request MapLibre makes — TileJSON, vector/raster tiles, glyphs, sprites, including requests dispatched from tile Web Workers — and rewrites any tiles.openfreemap.org/* URL to goodwebtools.com/ofm/* before the request is made.

This is the definitive fix: it works regardless of whether fetchResolvedStyle successfully rewrites the style object.

🤖 Generated with Claude Code

fetchResolvedStyle rewrites URLs in the style object but MapLibre still
makes its own fetches for TileJSON (when url is present on a vector
source), glyphs, and sprites — bypassing the proxy and hitting the
broken Singapore CDN edge directly.

transformRequest intercepts EVERY URL MapLibre dispatches (including
from tile Web Workers) and rewrites tiles.openfreemap.org/* to
goodwebtools.com/ofm/*, ensuring all OFM traffic goes through our
Cloudflare Worker regardless of what the style object contains.

This is the definitive safety net for the blank map bug.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@slaveofcode
slaveofcode merged commit 342f733 into develop Aug 8, 2026
1 of 2 checks passed
@slaveofcode
slaveofcode deleted the fix/map-transform-request branch August 8, 2026 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant