diff --git a/public/templates/wmts.tmpl b/public/templates/wmts.tmpl index 683c3ac84..0db7349c0 100644 --- a/public/templates/wmts.tmpl +++ b/public/templates/wmts.tmpl @@ -11,7 +11,7 @@ - + RESTful @@ -24,7 +24,7 @@ - + RESTful @@ -50,7 +50,7 @@ GoogleMapsCompatible - + GoogleMapsCompatible GoogleMapsCompatible EPSG:3857 @@ -403,5 +403,5 @@ 262144 - + diff --git a/src/server.js b/src/server.js index 9fedc02d6..1e0e02b09 100644 --- a/src/server.js +++ b/src/server.js @@ -419,7 +419,12 @@ function start(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; });