Closed bcamper closed 6 years ago
This is awesome! Thanks a lot.
@matteblair @tallytalwar are you good with this from a future ES perspective? (Should follow the syntax suggested by @matteblair.)
Yeah I don't see any problems implementing this in Tangram ES :+1:
Following up on #668: to enable cases where a client would like to send additional, custom HTTP headers with each tile request.
A data source can specify key/value pairs for header names/values, with the
request_headers
parameter. For example, if the tile backend is authorized with and OAuth token:While
request_headers
can be specified statically in the scene file, it's more likely they would be added programmatically at run-time (they could either be added after a sceneload
event, or by directly modifyingscene.config
and callingscene.updateConfig()
). They would also generally be expected to be used with custom tile sources.CORS
If the tile source is being made via CORS requests (the tile source's origin is different from the origin the the web page was loaded from), then adding custom
request_headers
will cause an additional "preflight"OPTIONS
request for each tile (before theGET
request for tile data). This extra request is required so that the client can verify that the server will accept the desired headers, which the server must authorize with theAccess-Control-Allow-Headers
header. See more info on CORS preflight requests.