Skip to content

Commit

Permalink
Merge pull request #215 from HSLdevcom/change-map-cache-key
Browse files Browse the repository at this point in the history
change map proxy cache key
  • Loading branch information
vesameskanen authored Dec 9, 2022
2 parents c968b09 + ec1287e commit 6f524c6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions common.conf
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ location /map/v1/ {
proxy_pass http://hsl-map-server:8080;
proxy_cache tiles;
proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504;
proxy_cache_key $map_cache_key;
proxy_cache_revalidate on;
proxy_cache_lock on;
proxy_redirect off;
Expand All @@ -150,6 +151,7 @@ location /map/v2/ {
proxy_pass http://hsl-map-server:8080;
proxy_cache tiles;
proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504;
proxy_cache_key $map_cache_key;
proxy_cache_revalidate on;
proxy_cache_lock on;
proxy_redirect off;
Expand All @@ -164,6 +166,7 @@ location /map/v3/ {
proxy_pass http://hsl-map-server:8080;
proxy_cache tiles;
proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504;
proxy_cache_key $map_cache_key;
proxy_cache_revalidate on;
proxy_cache_lock on;
proxy_redirect off;
Expand Down
7 changes: 6 additions & 1 deletion nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,17 @@ daemon off;
# because nginx doesn't copy port to redirects but always adds :8080

http {

# map custom proxy cache keys for geocoding and maps
map $request_uri $geo_cache_key {
"~(?<location>geocoding\/v1\/(.*)\?)digitransit-subscription-key=((.*?)\&)(?<params>(.*))" $location$params;
default $request_uri;
}

map $request_uri $map_cache_key {
"~(?<key_part>(.*map\/.*))\?digitransit-subscription-key=((.*))" $key_part;
default $request_uri;
}

log_format custom '$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_user_agent" $host $request_time';
Expand Down

0 comments on commit 6f524c6

Please sign in to comment.