Improved publicUrl option support
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.
This commit is contained in:
parent
082243bda9
commit
2d9e2f7f4e
2 changed files with 7 additions and 2 deletions
|
|
@ -41,7 +41,7 @@
|
|||
{{#if serving_data}}| {{/if}}<a href="{{public_url}}styles/{{@key}}.json{{&../key_query}}">TileJSON</a>
|
||||
{{/if}}
|
||||
{{#if serving_rendered}}
|
||||
| <a href="/styles/{{@key}}/wmts.xml{{&../key_query}}">WMTS</a>
|
||||
| <a href="{{public_url}}styles/{{@key}}/wmts.xml{{&../key_query}}">WMTS</a>
|
||||
{{/if}}
|
||||
{{#if xyz_link}}
|
||||
| <a href="#" onclick="return toggle_xyz('xyz_style_{{@key}}');">XYZ</a>
|
||||
|
|
|
|||
|
|
@ -419,7 +419,12 @@ function start(opts) {
|
|||
}
|
||||
wmts.id = id;
|
||||
wmts.name = (serving.styles[id] || serving.rendered[id]).name;
|
||||
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;
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue