Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 7 additions & 42 deletions external.conf
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
#smoove citybike api (http://helsinki-fi.smoove.pro/api-public/stations)
location /out/helsinki-fi.smoove.pro/ {
proxy_pass http://helsinki-fi.smoove.pro/;
include allowed-ips.conf;
proxy_cache ext_cache;
proxy_cache_valid 200 30s;
proxy_cache_lock on;
add_header X-Proxy-Cache $upstream_cache_status;
proxy_ignore_headers X-Accel-Expires Expires Cache-Control Set-Cookie;
proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504;
}

#turku smoove realtime api (http://data.foli.fi/gtfs-rt/reittiopas)
location /out/data.foli.fi/ {
proxy_pass http://data.foli.fi/;
Expand Down Expand Up @@ -333,9 +321,9 @@ location /out/waltti-cloudtest-agent.frendsapp.com/ {
proxy_set_header X-Api-Key FRENDS_API_KEY;
}

#donkey citybike api (for example https://stables.donkey.bike/api/public/gbfs/2/donkey_lappeenranta/gbfs.json)
location /out/stables.donkey.bike/ {
proxy_pass https://stables.donkey.bike/;
#hsl citybike api (https://gbfs.theta.fifteen.eu/gbfs/2.2/helsinki/en/gbfs.json)
location /out/gbfs.theta.fifteen.eu/ {
proxy_pass https://gbfs.theta.fifteen.eu/;
include allowed-ips.conf;
proxy_cache ext_cache;
proxy_cache_valid any 30s;
Expand All @@ -346,40 +334,17 @@ location /out/stables.donkey.bike/ {
proxy_ssl_server_name on;
}

#giravolta (seatcode) citybike api for vantaa
#for example https://vantaa-api.giravolta.io/api-opendata/gbfs/2_3/system_information get sent to
#https://api.giravolta.io/api-opendata/gbfs/2_3/system_information with correct authentication header
#replace urls in the discovery call with proxy address
location = /out/vantaa-api.giravolta.io/api-opendata/gbfs/2_3/gbfs {
proxy_pass https://api.giravolta.io/api-opendata/gbfs/2_3/gbfs;
include allowed-ips.conf;
proxy_cache ext_cache;
proxy_cache_valid any 30s;
proxy_cache_lock on;
add_header X-Proxy-Cache $upstream_cache_status;
proxy_ignore_headers X-Accel-Expires Expires Cache-Control Set-Cookie;
proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504;
#Default caching would use the $proxy_host so we need custom rule to use request host
proxy_cache_key $scheme$host$request_uri;
proxy_set_header Authorization GIRAVOLTA_VANTAA_AUTH;
sub_filter 'https://api.giravolta.io' 'http://digitransit-proxy:8080/out/vantaa-api.giravolta.io';
sub_filter_once off;
sub_filter_types *;
}

#giravolta api calls for vantaa
location /out/vantaa-api.giravolta.io/ {
proxy_pass https://api.giravolta.io/;
#donkey citybike api (for example https://stables.donkey.bike/api/public/gbfs/2/donkey_lappeenranta/gbfs.json)
location /out/stables.donkey.bike/ {
proxy_pass https://stables.donkey.bike/;
include allowed-ips.conf;
proxy_cache ext_cache;
proxy_cache_valid any 30s;
proxy_cache_lock on;
add_header X-Proxy-Cache $upstream_cache_status;
proxy_ignore_headers X-Accel-Expires Expires Cache-Control Set-Cookie;
proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504;
#Default caching would use the $proxy_host so we need custom rule to use request host
proxy_cache_key $scheme$host$request_uri;
proxy_set_header Authorization GIRAVOLTA_VANTAA_AUTH;
proxy_ssl_server_name on;
}

#Raasepori rt (https://bosse.mattersoft.fi/api/gtfsrealtime/v1.0/feed/tripupdate, servicealert and vehicleposition)
Expand Down
2 changes: 1 addition & 1 deletion test.js
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ describe('otp debug UIs with path beginning with "/otp" should return 404', func

describe('ext-proxy', function() {
this.timeout(5000);
testCaching(null,'/out/helsinki-fi.smoove.pro/api-public/stations',false);
testCaching(null,'/out/gbfs.theta.fifteen.eu/gbfs/2.2/helsinki/en/gbfs.json',false);
testCaching(null,'/out/data.foli.fi/gtfs-rt/reittiopas',false);
testCaching(null,'/out/stables.donkey.bike/api/public/gbfs/2/donkey_lappeenranta/en/station_status.json',false);
});
Expand Down
Loading