Skip to content

Commit

Permalink
Merge pull request #140 from HSLdevcom/hsl-ui-update
Browse files Browse the repository at this point in the history
Prepare hsl ui configuration for new UI release
  • Loading branch information
vesameskanen authored Nov 9, 2020
2 parents b8594c1 + b5bcc3d commit d275e9b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 38 deletions.
42 changes: 5 additions & 37 deletions nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -67,42 +67,7 @@ http {
}

server {
server_name dev.reittiopas.fi reittiopas.hsl.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-hsl: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-hsl: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 vanha.reittiopas.hsl.fi;
server_name vanha.reittiopas.hsl.fi dev.reittiopas.fi;
listen 8080;

if ($http_x_forwarded_proto != "https") {
Expand Down Expand Up @@ -163,6 +128,9 @@ http {
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 = / {
return 301 https://dev.hslfi.hsldev.com/?fromJourneyPlanner=true;
}
location / {
return 301 https://reittiopas.hsl.fi$request_uri;
}
Expand Down Expand Up @@ -260,7 +228,7 @@ http {
}

server {
server_name next-dev.digitransit.fi uusi.reittiopas.hsl.fi;
server_name next-dev.digitransit.fi uusi.reittiopas.hsl.fi reittiopas.hsl.fi;
listen 8080;

if ($http_x_forwarded_proto != "https") {
Expand Down
5 changes: 4 additions & 1 deletion test.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ describe('api.digitransit.fi', function() {

describe('hsl ui', function() {
testRedirect('reittiopas.fi','/kissa','https://reittiopas.hsl.fi/kissa');
testRedirect('reittiopas.fi','/','https://uusi.hsl.fi/?fromJourneyPlanner=true');
testRedirect('www.reittiopas.fi','/kissa','https://reittiopas.hsl.fi/kissa', true);
testRedirect('m.reittiopas.fi','/kissa','https://reittiopas.hsl.fi/kissa');
testRedirect('dev.reittiopas.fi','/kissa','https://dev.reittiopas.fi/kissa');
Expand All @@ -159,8 +160,10 @@ describe('hsl ui', function() {
});

testProxying('dev.reittiopas.fi','/','digitransit-ui-hsl:8080', true);
testResponseHeader('dev.reittiopas.fi','/kissa', 'x-robots-tag', 'noindex, nofollow, nosnippet, noarchive');

testProxying('reittiopas.hsl.fi','/','digitransit-ui-hsl:8080', true);
testRedirect('reittiopas.hsl.fi','/','https://uusi.hsl.fi/?fromJourneyPlanner=true', true);
testProxying('reittiopas.hsl.fi','/kissa','digitransit-ui-hsl-next:8080', true);

testCaching('reittiopas.hsl.fi','/sw.js', true);

Expand Down

0 comments on commit d275e9b

Please sign in to comment.