From 7122317f2a823298b9c65a565ad45cab7ee00f16 Mon Sep 17 00:00:00 2001 From: Julian Simioni Date: Fri, 25 May 2018 14:21:59 -0400 Subject: [PATCH] feat(attribution): allow overriding attribution URL This url is used to show attribution information for Pelias data sources It was often not detected correctly if, for example, the API is proxied behind a load balancer. --- middleware/geocodeJSON.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/middleware/geocodeJSON.js b/middleware/geocodeJSON.js index 0ff2e303..6c78d4a3 100644 --- a/middleware/geocodeJSON.js +++ b/middleware/geocodeJSON.js @@ -47,7 +47,7 @@ function convertToGeocodeJSON(req, res, next, opts) { // OPTIONAL. Default: null. The attribution of the data. In case of multiple sources, // and then multiple attributions, can be an object with one key by source. // Can be a URI on the server, which outlines attribution details. - res.body.geocoding.attribution = url.format({ + res.body.geocoding.attribution = opts.config.attributionURL || url.format({ protocol: req.protocol, host: req.get('host'), pathname: opts.basePath + 'attribution'