From 86c634db2823df2acbdaa28031fb8e193650ae46 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Thu, 12 Dec 2024 18:19:02 +0100 Subject: [PATCH] fix: make sure we set X-DataLayer-Version even when using X-Accel-Redirect --- docs/changelog.md | 22 +++++++++++++++++----- docs/deploy/nginx.md | 2 ++ umap/views.py | 2 +- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/docs/changelog.md b/docs/changelog.md index b7c6f246..b8ea3072 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -20,6 +20,18 @@ we introduce two new map statuses: Also pursuing the code cleaning (more modules and spliting uMap core code from Leaflet rendering one). +Finally, this is now the javascript who create the datalayer uuid, and then create it to the back. This +is for preparing for the synchronisation between clients. + +### Breaking change + +* if you use `X-Accel-Redirect` with Nginx, you **must** make sure that the `X-DataLayer-Version` header + is forwarded to the client. This is the line you usually need to add in your Nginx `/internal/` config: + + add_header X-DataLayer-Version $upstream_http_x_datalayer_version; + + See the [documentation](deploy/nginx.md) for more informations. + ### New features * add umap helm chart for Kubernetes deployment by @NaPs in #2286 * support storing layer data in S3 like servers by @yohanboniface in #2304 @@ -57,15 +69,15 @@ Also pursuing the code cleaning (more modules and spliting uMap core code from L ### Changed templates * umap/css.html: - - added `umap/css/bar.css` - - added `umap/css/popup.css` + * added `umap/css/bar.css` + * added `umap/css/popup.css` * umap/js.html: - - added `umap/css/bar.js` + * added `umap/css/bar.js` * umap/templates/registration/login.html * umap/templates/umap/map_init.html - - changed the way we instanciate `Umap` (instead of `U.Map`) + * changed the way we instanciate `Umap` (instead of `U.Map`) * umap/templates/umap/user_dashboard.html - - changed the way we instanciate `Umap` (instead of `U.Map`) + * changed the way we instanciate `Umap` (instead of `U.Map`) ### New Contributors * @NaPs made their first contribution in #2286 diff --git a/docs/deploy/nginx.md b/docs/deploy/nginx.md index eb97b725..e566c877 100644 --- a/docs/deploy/nginx.md +++ b/docs/deploy/nginx.md @@ -116,6 +116,8 @@ UMAP_XSENDFILE_HEADER = 'X-Accel-Redirect' internal; gzip_vary on; gzip_static on; + # Next line is very important! + add_header X-DataLayer-Version $upstream_http_x_datalayer_version; alias /path/to/umap/var/data/; } ``` diff --git a/umap/views.py b/umap/views.py index ae70405b..12c2d18f 100644 --- a/umap/views.py +++ b/umap/views.py @@ -1168,7 +1168,7 @@ class DataLayerView(BaseDetailView): # (no gzip/cache-control/If-Modified-Since/If-None-Match) data = self.filedata response = HttpResponse(data, content_type="application/geo+json") - response["X-Datalayer-Version"] = self.fileversion + response["X-Datalayer-Version"] = self.fileversion return response