Skip to content

Commit

Permalink
Merge pull request #151 from HSLdevcom/ratikka-ui-v3
Browse files Browse the repository at this point in the history
Add own ui for linjasto2021
  • Loading branch information
Kilbert76 authored Mar 25, 2021
2 parents bf1b7e9 + ae35d5b commit 5266ce1
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 5 deletions.
9 changes: 9 additions & 0 deletions common.conf
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,15 @@ location /ui/v1/waltti-next/ {
# proxy_set_header X-Forwarded-Host $host;
}

location /ui/v1/linjasto2021/ {
rewrite /ui/v1/linjasto2021/(.*) /$1 break;
proxy_pass http://digitransit-ui-linjasto2021:8080;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_set_header X-Forwarded-Host $host;
}

location /timetables/v1/hsl/ {
rewrite /timetables/v1/hsl/(.*) /hsl/$1 break;
proxy_pass http://hsl-timetable-container:8080;
Expand Down
38 changes: 36 additions & 2 deletions nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,7 @@ http {
dev-tampere.digitransit.fi tampere.digitransit.fi pilottirepa.tampere.fi repa.tampere.fi reittiopas.tampere.fi
dev-kouvola.digitransit.fi kouvola.digitransit.fi
dev-rovaniemi.digitransit.fi rovaniemi.digitransit.fi
dev-opas.waltti.fi opas.waltti.fi
dev-linjasto2021.digitransit.fi linjasto2021.digitransit.fi;
dev-opas.waltti.fi opas.waltti.fi;
listen 8080;

if ($http_x_forwarded_proto != "https") {
Expand Down Expand Up @@ -229,6 +228,41 @@ http {
}
}

server {
server_name dev-linjasto2021.digitransit.fi linjasto2021.digitransit.fi;
listen 8080;

if ($http_x_forwarded_proto != "https") {
return 301 https://$host$request_uri;
}

# Add HTTP Strict Transport Security for good measure.
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains;";

location = /sw.js {
proxy_pass http://digitransit-ui-linjasto2021:8080;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $host;
proxy_cache sw;
proxy_cache_valid 200 30s;
proxy_cache_lock on;
proxy_cache_key "$host$request_uri";
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;
}

location / {
proxy_pass http://digitransit-ui-linjasto2021:8080;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $host;
}
}

server {
server_name next-dev-hameenlinna.digitransit.fi
next-dev-joensuu.digitransit.fi
Expand Down
8 changes: 5 additions & 3 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,6 @@ describe('waltti ui', function() {
testRedirect('next-dev-opas.waltti.fi','/kissa','https://next-dev-opas.waltti.fi/kissa');
testProxying('next-dev-opas.waltti.fi','/','digitransit-ui-waltti-next:8080', true);

testRedirect('linjasto2021.digitransit.fi','/kissa','https://linjasto2021.digitransit.fi/kissa');
testProxying('linjasto2021.digitransit.fi','/','digitransit-ui-waltti:8080', true);

it('https should not redirect', function(done) {
httpsGet('turku.digitransit.fi','/kissa').end((err,res)=>{
expect(err).to.be.null;
Expand All @@ -246,6 +243,11 @@ describe('waltti ui', function() {
});
});

describe('linjasto2021 ui', function() {
testRedirect('linjasto2021.digitransit.fi','/kissa','https://linjasto2021.digitransit.fi/kissa');
testProxying('linjasto2021.digitransit.fi','/','digitransit-ui-linjasto2021:8080', true);
});

describe('sentry-analytics', function() {
testProxying('sentry-analytics.digitransit.fi','/','digitransit-sentry-analytics:8080', true);
testRedirect('sentry-analytics.digitransit.fi','/kissa','https://sentry-analytics.digitransit.fi/kissa');
Expand Down

0 comments on commit 5266ce1

Please sign in to comment.