fix: preserve capitalization in custom headers
Express converts all header names to lowercase, which prevents custom headers with uppercase characters from being properly passed to the target service. This fix ensures that custom headers preserve their original capitalization when forwarded through the proxy.
This commit is contained in:
parent
f87884900e
commit
3510e1a561
1 changed files with 3 additions and 2 deletions
|
|
@ -70,8 +70,9 @@ const getHttpHeaders = (
|
||||||
// If the header "x-custom-auth-header" is present, use its value as the custom header name.
|
// If the header "x-custom-auth-header" is present, use its value as the custom header name.
|
||||||
if (req.headers["x-custom-auth-header"] !== undefined) {
|
if (req.headers["x-custom-auth-header"] !== undefined) {
|
||||||
const customHeaderName = req.headers["x-custom-auth-header"] as string;
|
const customHeaderName = req.headers["x-custom-auth-header"] as string;
|
||||||
if (req.headers[customHeaderName] !== undefined) {
|
const lowerCaseHeaderName = customHeaderName.toLowerCase();
|
||||||
const value = req.headers[customHeaderName];
|
if (req.headers[lowerCaseHeaderName] !== undefined) {
|
||||||
|
const value = req.headers[lowerCaseHeaderName];
|
||||||
headers[customHeaderName] = value as string;
|
headers[customHeaderName] = value as string;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue