vector icon indicating copy to clipboard operation
vector copied to clipboard

http_server: add custom response headers

Open faust93 opened this issue 2 years ago • 0 comments

A note for the community

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Use Cases

I'm running multiple Vector instances behind AWS ALB to consume client data using an http_server listener. According to our security policy, the response must have CORS headers (Access-Control-Allow-Origin, etc.) and a few other custom ones for the client side to work. Since, as far as I know, neither ALB nor Vector have this functionality (to provide custom headers in the response), I have to use an Nginx proxy in between to provide these headers, which is an additional moving part that I wanted to get rid of.

Attempted Solutions

Nginx reverse proxy in front of Vector's http_server sink

Proposal

Logstash has 'response_headers', would be nice to have similar functionality in Vector

input {
    http {
        port => 3000
        response_headers => {
            "Content-Type" => "text/plain"
            "Access-Control-Allow-Headers" => "User-Agent,Origin,Content-Type,Accept,Accept-Encoding,Accept-Language,Content-Type,Cookie"
            "Access-Control-Allow-Methods" => "GET,PUT,POST,OPTIONS"
            "Access-Control-Allow-Origin" => "xxxx"
        }
    }
}

References

No response

Version

No response

faust93 avatar Apr 29 '24 14:04 faust93