Compare commits
1 Commits
developmen
...
proxy_hos_
Author | SHA1 | Date |
---|---|---|
YanJin | b09b812e38 |
|
@ -69,11 +69,15 @@ export default function createCanonicalRequest(
|
||||||
const signedHeadersList = pSignedHeaders.split(';');
|
const signedHeadersList = pSignedHeaders.split(';');
|
||||||
signedHeadersList.sort((a: any, b: any) => a.localeCompare(b));
|
signedHeadersList.sort((a: any, b: any) => a.localeCompare(b));
|
||||||
const signedHeaders = signedHeadersList.join(';');
|
const signedHeaders = signedHeadersList.join(';');
|
||||||
|
const isProxyHost = !!pHeaders['proxyhost'];
|
||||||
// canonical headers
|
// canonical headers
|
||||||
const canonicalHeadersList = signedHeadersList.map((signedHeader: any) => {
|
const canonicalHeadersList = signedHeadersList.map((signedHeader: any) => {
|
||||||
if (pHeaders[signedHeader] !== undefined) {
|
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, ' ');
|
.trim().replace(/\s+/g, ' ');
|
||||||
return `${signedHeader}:${trimmedHeader}\n`;
|
return `${signedHeader}:${trimmedHeader}\n`;
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,13 +133,13 @@ export function check(
|
||||||
}
|
}
|
||||||
|
|
||||||
let proxyPath: string | undefined;
|
let proxyPath: string | undefined;
|
||||||
if (request.headers.proxy_path) {
|
if (request.headers.proxypath) {
|
||||||
try {
|
try {
|
||||||
proxyPath = decodeURIComponent(request.headers.proxy_path);
|
proxyPath = decodeURIComponent(request.headers.proxypath);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
log.debug('invalid proxy_path header', { proxyPath, err });
|
log.debug('invalid proxypath header', { proxyPath, err });
|
||||||
return { err: errors.InvalidArgument.customizeDescription(
|
return { err: errors.InvalidArgument.customizeDescription(
|
||||||
'invalid proxy_path header') };
|
'invalid proxypath header') };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,13 +57,13 @@ export function check(request: any, log: Logger, data: { [key: string]: string }
|
||||||
}
|
}
|
||||||
|
|
||||||
let proxyPath: string | undefined;
|
let proxyPath: string | undefined;
|
||||||
if (request.headers.proxy_path) {
|
if (request.headers.proxypath) {
|
||||||
try {
|
try {
|
||||||
proxyPath = decodeURIComponent(request.headers.proxy_path);
|
proxyPath = decodeURIComponent(request.headers.proxypath);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
log.debug('invalid proxy_path header', { proxyPath });
|
log.debug('invalid proxypath header', { proxyPath });
|
||||||
return { err: errors.InvalidArgument.customizeDescription(
|
return { err: errors.InvalidArgument.customizeDescription(
|
||||||
'invalid proxy_path header') };
|
'invalid proxypath header') };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue