Skip to content

Add Stadia tile proxy with caching and theme attribution fixes#88

Merged
fityannugroho merged 7 commits intomainfrom
fix/map-auth
Dec 19, 2025
Merged

Add Stadia tile proxy with caching and theme attribution fixes#88
fityannugroho merged 7 commits intomainfrom
fix/map-auth

Conversation

@fityannugroho
Copy link
Owner

@fityannugroho fityannugroho commented Dec 19, 2025

PR Checklist

Please check if your PR fulfills the following requirements:

Put [x] to check

  • I have read the documentation.
  • I have read and followed the Contributing Guidelines.
  • I have included a pull request description of my changes.
  • I have included the necessary changes to the documentation.
  • I have added tests to cover my changes.

PR Type

What kind of change does this PR introduce?

Please check any kind of changes that applies to this PR using [x]

  • Bug fix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • ..... (describe the other type)

What is the current behavior?

Please describe the current behavior that you are modifying, or link to a relevant issue.

Issue Number: N/A

  • Stadia tiles used to work without an API key, but now require a key / enforce stricter limits; fetching directly from the client can’t keep the key server-side.

What is the new behavior?

  • Added /api/stadia-tiles/[...path] proxy route that:
    • Awaits route params (Next.js 15 compatible)
    • Injects STADIA_API_KEY server-side
    • Adds Cache-Control + Next.js revalidate with configurable TTL/SWR
  • Client style loading now optionally rewrites Stadia tile URLs to the proxy when NEXT_PUBLIC_STADIA_TILE_PROXY=1 (works in any environment).
  • Theme switches recreate the Maplibre layer to ensure attribution updates correctly, with cleanup to prevent duplicates and abort-safe style fetching.
  • Referrer policy is set via next.config.js and app/layout.tsx.
  • .env.example documents the new env vars.

Other information

  • Env:
    • STADIA_API_KEY
    • NEXT_PUBLIC_STADIA_TILE_PROXY
    • TILE_CACHE_MAX_AGE
    • TILE_CACHE_STALE_WHILE_REVALIDATE

@fityannugroho fityannugroho changed the title fix/map auth Fix tile proxy caching and theme attribution Dec 19, 2025
@fityannugroho fityannugroho added bug Something isn't working enhancement New feature or request javascript Pull requests that update javascript code labels Dec 19, 2025
@fityannugroho fityannugroho changed the title Fix tile proxy caching and theme attribution Add Stadia tile proxy, caching, and attribution fixes Dec 19, 2025
@fityannugroho fityannugroho changed the title Add Stadia tile proxy, caching, and attribution fixes Add Stadia tile proxy with caching and theme attribution fixes Dec 19, 2025
@fityannugroho fityannugroho added the documentation Improvements or additions to documentation label Dec 19, 2025
@fityannugroho fityannugroho merged commit 5ccca6f into main Dec 19, 2025
6 checks passed
@fityannugroho fityannugroho removed documentation Improvements or additions to documentation enhancement New feature or request javascript Pull requests that update javascript code labels Dec 19, 2025
@fityannugroho fityannugroho deleted the fix/map-auth branch December 19, 2025 12:44
fityannugroho added a commit that referenced this pull request Dec 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant