@springernature/backend-proxy
Advanced tools
Comparing version 1.3.0 to 1.3.1
# History | ||
## 1.3.1 | ||
_18/02/20_ | ||
- Specifies the host header in the correct order. ([joeyciechanowicz](https://github.com/joeyciechanowicz)) | ||
- Removes backend domain from location on a 30x response ([springerBuck](https://github.com/springerBuck)) | ||
## 1.3.0 | ||
@@ -4,0 +10,0 @@ _02/02/20_ |
{ | ||
"name": "@springernature/backend-proxy", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "Proxies frontend requests to a backend and can render the result", | ||
@@ -14,3 +14,3 @@ "main": "index.js", | ||
"test": "jest --coverage", | ||
"test:watch": "jest --watch --testPathIgnorePatterns integration" | ||
"test:watch": "jest --watch" | ||
}, | ||
@@ -17,0 +17,0 @@ "engines": { |
@@ -56,4 +56,4 @@ const http = require('http'); | ||
if (options.changeHost) { | ||
request.headers['X-Orig-Host'] = request.headers.host; | ||
request.headers.host = backendHttpOptions.host; | ||
request.headers['X-Orig-Host'] = request.hostname; | ||
} | ||
@@ -83,2 +83,10 @@ | ||
response.statusCode = backendResponse.statusCode; | ||
if (backendResponse.statusCode >= 300 && backendResponse.statusCode <= 399 && | ||
backendResponse.headers.location && | ||
backendResponse.headers.location.startsWith(options.backend)) { | ||
let locationUrl = new url.URL(backendResponse.headers.location); | ||
backendResponse.headers.location = locationUrl.pathname + locationUrl.search + locationUrl.hash; | ||
} | ||
response.header(backendResponse.headers); | ||
@@ -85,0 +93,0 @@ backendResponse.pipe(response); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16793
191