Skip to content

Commit

Permalink
change map proxy cache key
Browse files Browse the repository at this point in the history
  • Loading branch information
Topi Koivunen authored and Topi Koivunen committed Dec 9, 2022
1 parent c968b09 commit 4ed4d27
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 @@ -144,6 +144,7 @@ location /map/v1/ {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_set_header X-Forwarded-Host $host;
add_header X-Cache-Status $upstream_cache_status;
add_header X-Test $map_cache_key;
}

location /map/v2/ {
Expand All @@ -157,6 +158,7 @@ location /map/v2/ {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_set_header X-Forwarded-Host $host;
add_header X-Cache-Status $upstream_cache_status;
add_header X-Test $map_cache_key;
}

location /map/v3/ {
Expand All @@ -171,6 +173,7 @@ location /map/v3/ {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_set_header X-Forwarded-Host $host;
add_header X-Cache-Status $upstream_cache_status;
add_header X-Test $map_cache_key;
}

location /map/v3/hsl/fi/ {
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 4ed4d27

Please sign in to comment.