Skip to content

fix(map): use absolute URLs in transformRequest#21

Merged
ronload merged 2 commits into
mainfrom
fix/map-cors-absolute-url
Apr 15, 2026
Merged

fix(map): use absolute URLs in transformRequest#21
ronload merged 2 commits into
mainfrom
fix/map-cors-absolute-url

Conversation

@ronload

@ronload ronload commented Apr 15, 2026

Copy link
Copy Markdown
Owner

Summary

#20 的代理路徑使用相對 URL(如 /map-cdn/tiles/...),但 MapLibre 內部以 new Request(url) 建構請求物件,相對路徑會導致 Failed to parse URL 錯誤。改為以 window.location.origin 前綴產生完整絕對 URL。

Test plan

  • 部署至 preview -> 地圖正常渲染,console 無 URL parse 錯誤
  • Network tab 確認 tile 請求走 /map-cdn/tiles/ 並回傳 200

MapLibre constructs Request objects internally which require absolute
URLs. Prepend window.location.origin to proxied paths.
@vercel

vercel Bot commented Apr 15, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
zipkit Ready Ready Preview, Comment Apr 15, 2026 10:24am

@ronload ronload merged commit 95e38a5 into main Apr 15, 2026
3 checks passed
@ronload ronload deleted the fix/map-cors-absolute-url branch April 15, 2026 10:29
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