From bff699ba4afe548c8853a462ebd3ceaa6910d456 Mon Sep 17 00:00:00 2001 From: Lukomo <161812926+Lukomo@users.noreply.github.com> Date: Tue, 23 Apr 2024 23:55:39 +0400 Subject: [PATCH] feat: handle the X-Forwarded-Path header (#1197) * feat: handle the X-Forwarded-Path header * fix: lint Signed-off-by: acalcutt --------- Signed-off-by: acalcutt Co-authored-by: Zsolt Jakubinyi Co-authored-by: acalcutt --- src/utils.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/utils.js b/src/utils.js index b5b737b..58c8f5e 100644 --- a/src/utils.js +++ b/src/utils.js @@ -114,9 +114,10 @@ export const getTileUrls = ( const uris = []; if (!publicUrl) { + let xForwardedPath = `${req.get('X-Forwarded-Path') ? '/' + req.get('X-Forwarded-Path') : ''}`; for (const domain of domains) { uris.push( - `${req.protocol}://${domain}/${path}/${tileParams}.${format}${query}`, + `${req.protocol}://${domain}${xForwardedPath}/${path}/${tileParams}.${format}${query}`, ); } } else {