Comparing version 1.0.2 to 1.0.3
@@ -149,5 +149,7 @@ /** | ||
{ | ||
var protocol; | ||
var protocol, requestUri, host; | ||
if (request.headers.origin || request.referer) | ||
if (request.headers['x-proxy-scheme']) | ||
protocol = request.headers['x-proxy-scheme'] + ':'; | ||
else if (request.headers.origin || request.referer) | ||
protocol = (request.headers.origin || request.referer).match(/(^[a-z]*:)\/\//)[1]; | ||
@@ -157,6 +159,9 @@ else | ||
if (request.headers.host && request.url) | ||
return new URL(protocol + '//' + request.headers.host + request.url); | ||
host = request.headers['x-proxy-host'] || request.headers.host; | ||
requestUri = request.headers['x-proxy-request-uri'] || request.url; | ||
throw new Error('could not determine server name or url from request'); | ||
if (!protocol || !requestUri || !host) | ||
throw new Error('could not determine server name or url from request'); | ||
return new URL(protocol + '//' + host + requestUri); | ||
} | ||
@@ -166,3 +171,3 @@ | ||
* Return the location of the service, from the Internet's POV. This is often, but not always, | ||
* the same as the listen location, and can oftten, but not always, inferred from the request. | ||
* the same as the listen location, and can often, but not always, inferred from the request. | ||
* If `config.location` is specified and it is not the same instance of URL as `config.listen`, | ||
@@ -169,0 +174,0 @@ * then we use that location. Otherwise, we try and figure it out. |
@@ -38,4 +38,5 @@ /** | ||
var contentType = query.contentType; | ||
var location = utils.getLocation(request); | ||
var href = `${location.protocol}//${location.host}/methods/download/jobs/${job}/${elementType}/${element}`; | ||
var location = utils.getLocation(request); | ||
var methodPath = location.pathname.replace(/\/upload$/, ''); | ||
var href = `${location.protocol}//${location.host}${methodPath}/download/jobs/${job}/${elementType}/${element}`; | ||
@@ -42,0 +43,0 @@ //console.log(`dcp-rds:utils:upload query ${utils.stringify(query)}\n`); |
@@ -9,3 +9,2 @@ /** | ||
*/ | ||
const process = require('process'); | ||
@@ -16,2 +15,3 @@ const fs = require('fs'); | ||
const prefix = path.resolve(process.env.npm_config_prefix); | ||
const storage = path.join(prefix, 'storage'); | ||
@@ -28,4 +28,2 @@ console.log('DCP Remote Data Service: post-install'); | ||
//if (!process.env.DEBUG) | ||
// console.debug = function(){}; | ||
console.debug(` - installed in ${process.env.npm_config_prefix}`); | ||
@@ -37,5 +35,7 @@ console.debug(` - running in ${process.cwd()}`); | ||
console.log(`\nTo complete the install, run the following commands:`); | ||
console.log(`\nTo complete the install, run the following commands (Ubuntu Linux):`); | ||
console.log(`\tsudo useradd dcp-rds -d "${storage}" --system`); | ||
console.log(`\tsudo mkdir "${storage}"`); | ||
console.log(`\tsudo chown dcp-rds "${storage}"`); | ||
console.log(`\tsudo mkdir "${path.dirname(niceConfig)}"`); | ||
console.log(`\tsudo mkdir "${path.join(prefix, 'storage')}"`); | ||
console.log(`\tsudo cp --no-clobber "${sampleConfig}" "${niceConfig}"`); | ||
@@ -42,0 +42,0 @@ console.log(`\tsed -e "s;/var/dcp-rds/;${prefix}/;" < "${process.cwd()}/systemctl/dcp-rds.service" | sudo sh -c 'cat > /etc/systemd/system/dcp-rds.service'`); |
{ | ||
"name": "dcp-rds", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "DCP Remote Data Service reference implementation", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -170,2 +170,17 @@ # DCP Remote Data Service | ||
``` | ||
location /dcp-rds/methods { | ||
proxy_set_header X-Proxy-Scheme $scheme; | ||
proxy_set_header X-Proxy-Host $http_host; | ||
proxy_set_header X-Proxy-Request-Uri $request_uri; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_pass http://localhost:3521/methods; | ||
} | ||
location ~* /dcp-rds/browser-test { | ||
root /var/dcp-rds/lib/node_modules/; | ||
try_files $uri =404; | ||
} | ||
``` | ||
#### Apache Integration | ||
@@ -172,0 +187,0 @@ |
Sorry, the diff of this file is not supported yet
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
83110
1061
273