Skip to content

Commit 3510e1a

Browse files
committed
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.
1 parent f878849 commit 3510e1a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

server/src/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,9 @@ const getHttpHeaders = (
7070
// If the header "x-custom-auth-header" is present, use its value as the custom header name.
7171
if (req.headers["x-custom-auth-header"] !== undefined) {
7272
const customHeaderName = req.headers["x-custom-auth-header"] as string;
73-
if (req.headers[customHeaderName] !== undefined) {
74-
const value = req.headers[customHeaderName];
73+
const lowerCaseHeaderName = customHeaderName.toLowerCase();
74+
if (req.headers[lowerCaseHeaderName] !== undefined) {
75+
const value = req.headers[lowerCaseHeaderName];
7576
headers[customHeaderName] = value as string;
7677
}
7778
}

0 commit comments

Comments
 (0)