fix(titiler): drop @1x suffix + append SAS token top-level
TiTiler /tiles/{z}/{x}/{y} takes a strict int for y; the @1x scale-suffix
template 422s on every SAR tile request (int_parsing on '21@1x').
sign_cog_url wrapped the Planetary Computer SAS token under a single
token= param, which Azure rejects (403→409); the token is a pre-encoded
query string and must be appended top-level (st=…&se=…&sig=…).
Proven live: correct-form URL renders a 200 image/png 256px tile.
This commit is contained in:
parent
405845067e
commit
68e1b63421
2 changed files with 19 additions and 12 deletions
|
|
@ -50,7 +50,7 @@ PC_SAS_TOKEN = "https://planetarycomputer.microsoft.com/api/sas/v1/token/sentine
|
|||
# Self-hosted TiTiler on the Pi, exposed same-origin through the osint.rpi.local
|
||||
# nginx vhost. Relative template — Leaflet resolves it against the page origin,
|
||||
# so the browser never touches a raw loopback port or titiler.xyz.
|
||||
TITILER_COG_TILES = f"{TITILER_PUBLIC_BASE}/cog/tiles/WebMercatorQuad/{{z}}/{{x}}/{{y}}@1x"
|
||||
TITILER_COG_TILES = f"{TITILER_PUBLIC_BASE}/cog/tiles/WebMercatorQuad/{{z}}/{{x}}/{{y}}"
|
||||
SENTINEL1_TTL = 20 * 60 # 15–30 min quota-friendly window
|
||||
SENTINEL1_ATTRIBUTION = "Copernicus Sentinel-1 / Microsoft Planetary Computer"
|
||||
|
||||
|
|
@ -1194,9 +1194,15 @@ async def _pc_call(coro: Awaitable[Any]) -> Any:
|
|||
|
||||
|
||||
def sign_cog_url(href: str, token: str) -> str:
|
||||
"""Append a SAS token to a PC blob URL (respect existing query string)."""
|
||||
"""Append a SAS token to a PC blob URL (respect existing query string).
|
||||
|
||||
PC's SAS endpoint returns the token as an already-percent-encoded query
|
||||
string (``st=…&se=…&sp=rl&…&sig=…``). Azure only honours those parameters
|
||||
when they sit top-level on the blob URL — wrapping them under a single
|
||||
``token=`` param yields 403/409, so we append the token verbatim.
|
||||
"""
|
||||
sep = "&" if "?" in href else "?"
|
||||
return f"{href}{sep}token={quote(token, safe='')}"
|
||||
return f"{href}{sep}{token}"
|
||||
|
||||
|
||||
def sentinel1_tile_url(signed_cog: str) -> str:
|
||||
|
|
|
|||
Loading…
Reference in a new issue