vrata icon indicating copy to clipboard operation
vrata copied to clipboard

Add whitelist for custom headers that will be forwarded to the micros…

Open witschko opened this issue 7 years ago • 1 comments

…ervices. A new environment variable X_HEADER_WHITELIST can be filled with a JSON object that contains custom HTTP headers.

This references #24.

witschko avatar Feb 25 '19 10:02 witschko

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

leohubert avatar May 30 '19 20:05 leohubert