Skip to content

Conversation

@witschko
Copy link
Contributor

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

This references #24.

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

leohubert commented May 30, 2019

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


foreach ($whiteList as $key => $value) {
$headers[$key] = $value;
}
Copy link
Contributor

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

Copy link
Contributor Author

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

Copy link
Contributor Author

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.

@witschko witschko closed this Nov 19, 2019
@witschko witschko reopened this Nov 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants