diff --git a/common.conf b/common.conf index 6a0f204..ac68de8 100644 --- a/common.conf +++ b/common.conf @@ -177,6 +177,20 @@ location /map/v1/next- { # add_header X-Cache-Status $upstream_cache_status; } +location /map/v1/linjasto2021- { + rewrite /map/v1/linjasto2021-(.*) /map/v1/$1 break; + proxy_pass http://hsl-map-server-linjasto2021:8080; + # proxy_cache tiles; + # proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504; + # proxy_cache_revalidate on; + # proxy_cache_lock on; + 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; + # add_header X-Cache-Status $upstream_cache_status; +} + location /map/v1/ { proxy_pass http://hsl-map-server:8080; proxy_cache tiles; @@ -268,6 +282,16 @@ location /routing/v1/routers/next-waltti { proxy_read_timeout 11500ms; } +location /routing/v1/routers/linjasto2021-waltti { + rewrite /routing/v1/routers/linjasto2021-waltti(.*) /otp/routers/default$1 break; + proxy_pass http://opentripplanner-linjasto2021-waltti: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_read_timeout 11500ms; +} + location /routing-data/v2/hsl { rewrite /routing-data/v2/hsl/(.*) /$1 break; proxy_pass http://opentripplanner-data-con-hsl:8080/; @@ -318,6 +342,16 @@ location /routing-data/v2/next-waltti { include cors.conf; } +location /routing-data/v2/linjasto2021-waltti { + rewrite /routing-data/v2/linjasto2021-waltti/(.*) /$1 break; + proxy_pass http://opentripplanner-data-con-linjasto2021-waltti: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; + include cors.conf; +} + location /routing-data/v2/next-finland { rewrite /routing-data/v2/next-finland/(.*) /$1 break; proxy_pass http://opentripplanner-data-con-finland:8080/; diff --git a/nginx.conf b/nginx.conf index 87c9319..794cd24 100644 --- a/nginx.conf +++ b/nginx.conf @@ -194,7 +194,8 @@ 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-opas.waltti.fi opas.waltti.fi + dev-linjasto2021.digitransit.fi linjasto2021.digitransit.fi; listen 8080; if ($http_x_forwarded_proto != "https") { diff --git a/package-lock.json b/package-lock.json index 77811ff..574d727 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,9 +10,9 @@ "integrity": "sha1-TQJjewZ/6Vi9v906QOxW/vc3Mkc=", "dev": true, "requires": { - "assertion-error": "1.0.2", - "deep-eql": "0.1.3", - "type-detect": "1.0.0" + "assertion-error": "^1.0.1", + "deep-eql": "^0.1.3", + "type-detect": "^1.0.0" }, "dependencies": { "assertion-error": { @@ -52,11 +52,11 @@ "integrity": "sha1-VGDYA24fGhKwtbXL1Snm3B0x60s=", "dev": true, "requires": { - "cookiejar": "2.0.6", + "cookiejar": "2.0.x", "is-ip": "1.0.0", - "methods": "1.1.2", - "qs": "6.5.0", - "superagent": "2.3.0" + "methods": "^1.1.2", + "qs": "^6.2.0", + "superagent": "^2.0.0" }, "dependencies": { "async": { @@ -71,7 +71,7 @@ "integrity": "sha1-k4NwpXtKUd6ix3wV1cX9+JUWQAk=", "dev": true, "requires": { - "delayed-stream": "1.0.0" + "delayed-stream": "~1.0.0" } }, "component-emitter": { @@ -119,9 +119,9 @@ "integrity": "sha1-BaxrwiIntD5EYfSIFhVUaZ1Pi14=", "dev": true, "requires": { - "async": "1.5.2", - "combined-stream": "1.0.5", - "mime-types": "2.1.16" + "async": "^1.5.2", + "combined-stream": "^1.0.5", + "mime-types": "^2.1.10" } }, "formidable": { @@ -142,7 +142,7 @@ "integrity": "sha1-K7aVn3l8zW+f3IEnWLy8h8TFkHQ=", "dev": true, "requires": { - "ip-regex": "1.0.3" + "ip-regex": "^1.0.0" } }, "isarray": { @@ -169,7 +169,7 @@ "integrity": "sha1-K4WKUuXs1RbbiXrCvodIeDBpjiM=", "dev": true, "requires": { - "mime-db": "1.29.0" + "mime-db": "~1.29.0" } }, "ms": { @@ -196,13 +196,13 @@ "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", "dev": true, "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "1.0.0", - "process-nextick-args": "1.0.7", - "safe-buffer": "5.1.1", - "string_decoder": "1.0.3", - "util-deprecate": "1.0.2" + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~1.0.6", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.0.3", + "util-deprecate": "~1.0.1" } }, "string_decoder": { @@ -211,7 +211,7 @@ "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", "dev": true, "requires": { - "safe-buffer": "5.1.1" + "safe-buffer": "~5.1.0" } }, "superagent": { @@ -220,16 +220,16 @@ "integrity": "sha1-cDUpoHFOV+EjlZ3e+84ZOy5Q0RU=", "dev": true, "requires": { - "component-emitter": "1.2.1", - "cookiejar": "2.0.6", - "debug": "2.6.8", - "extend": "3.0.1", + "component-emitter": "^1.2.0", + "cookiejar": "^2.0.6", + "debug": "^2.2.0", + "extend": "^3.0.0", "form-data": "1.0.0-rc4", - "formidable": "1.1.1", - "methods": "1.1.2", - "mime": "1.6.0", - "qs": "6.5.0", - "readable-stream": "2.3.3" + "formidable": "^1.0.17", + "methods": "^1.1.1", + "mime": "^1.3.4", + "qs": "^6.1.0", + "readable-stream": "^2.0.5" }, "dependencies": { "mime": { @@ -291,7 +291,7 @@ "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", "dev": true, "requires": { - "balanced-match": "1.0.0", + "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, @@ -307,7 +307,7 @@ "integrity": "sha1-nJkJQXbhIkDLItbFFGCYQA/g99Q=", "dev": true, "requires": { - "graceful-readlink": "1.0.1" + "graceful-readlink": ">= 1.0.0" } }, "concat-map": { @@ -349,12 +349,12 @@ "integrity": "sha1-gFIR3wT6rxxjo2ADBs31reULLsg=", "dev": true, "requires": { - "fs.realpath": "1.0.0", - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.2", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" } }, "graceful-readlink": { @@ -381,8 +381,8 @@ "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "dev": true, "requires": { - "once": "1.4.0", - "wrappy": "1.0.2" + "once": "^1.3.0", + "wrappy": "1" } }, "json3": { @@ -397,8 +397,8 @@ "integrity": "sha1-jDigmVAPIVrQnlnxci/QxSv+Ck4=", "dev": true, "requires": { - "lodash._basecopy": "3.0.1", - "lodash.keys": "3.1.2" + "lodash._basecopy": "^3.0.0", + "lodash.keys": "^3.0.0" } }, "lodash._basecopy": { @@ -431,9 +431,9 @@ "integrity": "sha1-1/KEnw29p+BGgruM1yqwIkYd6+c=", "dev": true, "requires": { - "lodash._baseassign": "3.2.0", - "lodash._basecreate": "3.0.3", - "lodash._isiterateecall": "3.0.9" + "lodash._baseassign": "^3.0.0", + "lodash._basecreate": "^3.0.0", + "lodash._isiterateecall": "^3.0.0" } }, "lodash.isarguments": { @@ -454,9 +454,9 @@ "integrity": "sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo=", "dev": true, "requires": { - "lodash._getnative": "3.9.1", - "lodash.isarguments": "3.1.0", - "lodash.isarray": "3.0.4" + "lodash._getnative": "^3.0.0", + "lodash.isarguments": "^3.0.0", + "lodash.isarray": "^3.0.0" } }, "minimatch": { @@ -465,7 +465,7 @@ "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true, "requires": { - "brace-expansion": "1.1.8" + "brace-expansion": "^1.1.7" } }, "minimist": { @@ -495,7 +495,7 @@ "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "dev": true, "requires": { - "wrappy": "1.0.2" + "wrappy": "1" } }, "path-is-absolute": { @@ -510,7 +510,7 @@ "integrity": "sha1-cqJiiU2dQIuVbKBf83su2KbiotU=", "dev": true, "requires": { - "has-flag": "1.0.0" + "has-flag": "^1.0.0" } }, "wrappy": { diff --git a/test.js b/test.js index 9d96d3f..2f16eab 100644 --- a/test.js +++ b/test.js @@ -235,6 +235,9 @@ 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;