Bugfix: publicUrl is not used in some urls (#605)

In WMTS the publicUrl path was missed and it was not working properly.
Similar story about wmts.tmpl: the baseUrl is not working properly when
tileserver is hidden behind the proxy with different root path.

* Minor bugfix: make baseUrl always use '/' in the end

Co-authored-by: Oleksandr Shyshatskyi <oshyshatskyi@cloudlinux.com>
Co-authored-by: acalcutt <acalcutt@techidiots.net>
This commit is contained in:
Monstrofil
2022-09-30 16:18:13 +03:00
committed by GitHub
parent 7f6d6bc994
commit 38604c0a45
2 changed files with 10 additions and 5 deletions

View File

@@ -420,7 +420,12 @@ export function server(opts) {
}
wmts.id = id;
wmts.name = (serving.styles[id] || serving.rendered[id]).name;
wmts.baseUrl = `${req.get('X-Forwarded-Protocol') ? req.get('X-Forwarded-Protocol') : req.protocol}://${req.get('host')}`;
if (opts.publicUrl) {
wmts.baseUrl = opts.publicUrl;
}
else {
wmts.baseUrl = `${req.get('X-Forwarded-Protocol') ? req.get('X-Forwarded-Protocol') : req.protocol}://${req.get('host')}/`;
}
return wmts;
});