vrata
vrata copied to clipboard
Add whitelist for custom headers that will be forwarded to the micros…
…ervices. A new environment variable X_HEADER_WHITELIST can be filled with a JSON object that contains custom HTTP headers.
This references #24.
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 TEST=Foo micro service will receive TEST=Foo