-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add whitelist for custom headers that will be forwarded to the micros… #27
base: master
Are you sure you want to change the base?
Conversation
…ervices. A new environment variable X_HEADER_WHITELIST can be filled with a JSON object that contains custom HTTP headers.
It's not better to forward Header value receive from Client ? Like this. // Check if there are whitelisted custom headers
$whiteList = config('gateway.headers', '');
if ($whiteList != '') {
foreach ($whiteList as $key) {
if ($request->headers->has($key)) {
$headers[$key] = $request->headers->get($key);
}
}
} And for header white list config i have this. // Header white list to forward to micro services
'headers' => [
'TEST',
] So if client put i request header |
|
||
foreach ($whiteList as $key => $value) { | ||
$headers[$key] = $value; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm if I understand correctly, this is not really a white list (a list of allowed headers to pass through) but a pre-defined list of headers to pass? then it should be called something else, eg extra headers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok...you're right. I think then we should go with the suggestion of @MrDarkSkil
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have updated the PR to match the real whitelist functionality.
…ervices. A new environment variable X_HEADER_WHITELIST can be filled with a JSON object that contains custom HTTP headers.
This references #24.