Support local:// raster tile URLs
In the style JSON configuration, allow to use the local:// pseudo-protocol prefix also for raster tile source URLs. When serving the style JSON, rewrite it into an absolute URL using the public URL or the Host header from the request. This allows to use raster tile sources which are served from the same domain, but externally from tileserver-gl. The requests could be handled by a reverse proxy in front of tileserver-gl for example, and redirected to a different service or static files. Instead of hardcoding an absolute host name in the style configuration, using a relative URL allows to use the same style configuration on different hosts and on localhost in the development environment.
This commit is contained in:
parent
a5a8ae1e95
commit
13c481b1ea
1 changed files with 3 additions and 0 deletions
|
|
@ -40,6 +40,9 @@ module.exports = {
|
|||
for (const name of Object.keys(styleJSON_.sources)) {
|
||||
const source = styleJSON_.sources[name];
|
||||
source.url = fixUrl(req, source.url, item.publicUrl);
|
||||
if (source.tiles) {
|
||||
source.tiles = source.tiles.map(url => fixUrl(req, url, item.publicUrl))
|
||||
}
|
||||
}
|
||||
// mapbox-gl-js viewer cannot handle sprite urls with query
|
||||
if (styleJSON_.sprite) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue