Compare commits
1 Commits
developmen
...
proxy_host
Author | SHA1 | Date |
---|---|---|
Nicolas Humbert | 93f2709413 |
|
@ -14,6 +14,9 @@ function constructStringToSign(params) {
|
|||
query, log, proxyPath } = params;
|
||||
const path = proxyPath || request.path;
|
||||
|
||||
console.log('request.headers!!!', request.headers);
|
||||
console.log('path!!!', path);
|
||||
|
||||
const canonicalReqResult = createCanonicalRequest({
|
||||
pHttpVerb: request.method,
|
||||
pResource: path,
|
||||
|
|
|
@ -64,10 +64,18 @@ function createCanonicalRequest(params) {
|
|||
signedHeadersList.sort((a, b) => a.localeCompare(b));
|
||||
const signedHeaders = signedHeadersList.join(';');
|
||||
|
||||
console.log('pHeaders!!!', pHeaders);
|
||||
console.log('pSignedHeaders!!!', pSignedHeaders);
|
||||
|
||||
const isProxyHost = !!pHeaders['proxyhost']
|
||||
// canonical headers
|
||||
const canonicalHeadersList = signedHeadersList.map(signedHeader => {
|
||||
if (pHeaders[signedHeader] !== undefined) {
|
||||
const trimmedHeader = pHeaders[signedHeader]
|
||||
let header = pHeaders[signedHeader];
|
||||
if (isProxyHost && signedHeader.toLowerCase() === 'host') {
|
||||
header = pHeaders['proxyhost'];
|
||||
}
|
||||
const trimmedHeader = header
|
||||
.trim().replace(/\s+/g, ' ');
|
||||
return `${signedHeader}:${trimmedHeader}\n`;
|
||||
}
|
||||
|
@ -85,6 +93,7 @@ function createCanonicalRequest(params) {
|
|||
const canonicalRequest = `${pHttpVerb}\n${canonicalURI}\n` +
|
||||
`${canonicalQueryStr}\n${canonicalHeaders}\n` +
|
||||
`${signedHeaders}\n${payloadChecksum}`;
|
||||
console.log('canonicalRequest!!!', canonicalRequest);
|
||||
return canonicalRequest;
|
||||
}
|
||||
|
||||
|
|
|
@ -128,13 +128,13 @@ function check(request, log, data, awsService) {
|
|||
}
|
||||
|
||||
let proxyPath = null;
|
||||
if (request.headers.proxy_path) {
|
||||
if (request.headers.proxypath) {
|
||||
try {
|
||||
proxyPath = decodeURIComponent(request.headers.proxy_path);
|
||||
proxyPath = decodeURIComponent(request.headers.proxypath);
|
||||
} catch (err) {
|
||||
log.debug('invalid proxy_path header', { proxyPath, err });
|
||||
log.debug('invalid proxypath header', { proxyPath, err });
|
||||
return { err: errors.InvalidArgument.customizeDescription(
|
||||
'invalid proxy_path header') };
|
||||
'invalid proxypath header') };
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -63,13 +63,13 @@ function check(request, log, data) {
|
|||
}
|
||||
|
||||
let proxyPath = null;
|
||||
if (request.headers.proxy_path) {
|
||||
if (request.headers.proxypath) {
|
||||
try {
|
||||
proxyPath = decodeURIComponent(request.headers.proxy_path);
|
||||
proxyPath = decodeURIComponent(request.headers.proxypath);
|
||||
} catch (err) {
|
||||
log.debug('invalid proxy_path header', { proxyPath });
|
||||
log.debug('invalid proxypath header', { proxyPath });
|
||||
return { err: errors.InvalidArgument.customizeDescription(
|
||||
'invalid proxy_path header') };
|
||||
'invalid proxypath header') };
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue