[nominatim-web] Use shortened arg_lon and arg_lat in upstream request
- From: Bartłomiej Piotrowski <bpiotrowski src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nominatim-web] Use shortened arg_lon and arg_lat in upstream request
- Date: Tue, 26 May 2020 21:36:11 +0000 (UTC)
commit 4c794c459f114a0fd4a870741d5f5835072ee1d3
Author: Bartłomiej Piotrowski <bpiotrowski gnome org>
Date: Tue May 26 23:35:38 2020 +0200
Use shortened arg_lon and arg_lat in upstream request
nginx.conf | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
---
diff --git a/nginx.conf b/nginx.conf
index dd3950b..60edd5c 100644
--- a/nginx.conf
+++ b/nginx.conf
@@ -28,6 +28,7 @@ http {
keepalive_timeout 65;
#gzip on;
+ rewrite_by_lua_no_postpone on;
upstream nominatim {
server nominatim-int.gnome.org:80;
@@ -75,11 +76,10 @@ http {
proxy_pass http://nominatim/search;
proxy_set_header Host "nominatim-int.gnome.org";
- add_header X-Cache-Status $srcache_fetch_status;
}
location = /reverse {
- set_by_lua_block $coord {
+ rewrite_by_lua '
local shorten = function (str)
if string.sub(str,1,1) == "-" then
return string.sub(str,1,9)
@@ -89,13 +89,12 @@ http {
end
local args = ngx.req.get_uri_args()
- local lat = shorten(args["lat"])
- local lon = shorten(args["lon"])
+ args.lat = shorten(args.lat)
+ args.lon = shorten(args.lon)
+ ngx.req.set_uri_args(args)
+ ';
- return lat .. "x" .. lon
- }
-
- set $cache_key reverse_$lang$coord;
+ set $cache_key "reverse_$lang${arg_lat}x${arg_lon}";
srcache_fetch GET /redis-fetch $cache_key;
srcache_store PUT /redis-store key=$cache_key;
srcache_store_no_cache on;
@@ -103,7 +102,6 @@ http {
proxy_pass http://nominatim/reverse;
proxy_set_header Host "nominatim-int.gnome.org";
- add_header X-Cache-Status $srcache_fetch_status;
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]