use x-map-root-url header to generate publicUrl accessing via proxy

This commit is contained in:
guidomocha 2022-01-22 22:37:31 +03:30 committed by GitHub
parent 521f1ab371
commit 099ba2c395
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7,7 +7,7 @@ const clone = require('clone');
const glyphCompose = require('@mapbox/glyph-pbf-composite');
module.exports.getPublicUrl = (publicUrl, req) => publicUrl || (req.headers.x-forwarded-host ? `${req.headers.x-forwarded-proto || req.protocol}://${req.headers.x-forwarded-host}/` : `${req.protocol}://${req.headers.host}/`);
module.exports.getPublicUrl = (publicUrl, req) => publicUrl || (req.headers.x-forwarded-host ? `${req.headers.x-forwarded-proto || req.protocol}://${req.headers.x-forwarded-host}${req.headers.x-map-root-url}/` : `${req.protocol}://${req.headers.host}/`);
module.exports.getTileUrls = (req, domains, path, format, publicUrl, aliases) => {