Skip to content

Vector does not put the Proxy-Authorization header on the wire  #17353

Closed
@syedriko

Description

@syedriko

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

Problem

With an HTTP proxy with a username and password configured for an http or an elasticsearch sink, vector does communicate with the configured proxy, but it does not include the Proxy-Authorization header in the outgoing HTTP request. Confirmed with Wireshark:

Hypertext Transfer Protocol
    GET http://foobar:9200/ HTTP/1.1\r\n
        [Expert Info (Chat/Sequence): GET http://foobar:9200/ HTTP/1.1\r\n]
            [GET http://foobar:9200/ HTTP/1.1\r\n]
            [Severity level: Chat]
            [Group: Sequence]
        Request Method: GET
        Request URI: http://foobar:9200/
        Request Version: HTTP/1.1
    user-agent: Vector/0.30.0-custom-5d3f619ef3 (x86_64-unknown-linux-gnu debug=full)\r\n
    accept-encoding: identity\r\n
    host: foobar:9200\r\n
    \r\n
    [Full request URI: http://foobar:9200/]
    [HTTP request 1/3]
    [Response in frame: 73]
    [Next request in frame: 100]

Configuration

data_dir = "/tmp"

[sources.log_generator]
type = "demo_logs"
format = "json"

[sinks.console]
inputs = ["log_generator"]
type = "console"
target = "stdout"
[sinks.console.encoding]
codec = "json"

[sinks.default]
type = "http"
inputs = ["log_generator"]
uri = "http://foobar:9200"
encoding.codec = "json"
proxy.http = "http://proxy-user1:JYgU8qRZV4DY4PXJbxJK@localhost:9200"

Version

vector 0.30.0-custom-5d3f619ef3 (x86_64-unknown-linux-gnu debug=full)

Debug Output

No response

Example Data

No response

Additional Context

With inspiration from https://github.com/tafia/hyper-proxy/blob/aca1e1f5546ed5530e1a72dc5e07c5ed4b6099b3/src/lib.rs#L32, I hacked addition of proxy headers to the outgoing HTTP requests syedriko@27459d0 and got the Authorization and Proxy-Authorization headers added to the HTTP requests. Here's a capture from Wireshark:

Hypertext Transfer Protocol
    GET http://foobar:9200/ HTTP/1.1\r\n
        [Expert Info (Chat/Sequence): GET http://foobar:9200/ HTTP/1.1\r\n]
            [GET http://foobar:9200/ HTTP/1.1\r\n]
            [Severity level: Chat]
            [Group: Sequence]
        Request Method: GET
        Request URI: http://foobar:9200/
        Request Version: HTTP/1.1
    user-agent: Vector/0.30.0-custom-5d3f619ef3 (x86_64-unknown-linux-gnu debug=full)\r\n
    accept-encoding: identity\r\n
    authorization: Basic cHJveHktdXNlcjE6SllnVThxUlpWNERZNFBYSmJ4Sks=\r\n
        Credentials: proxy-user1:JYgU8qRZV4DY4PXJbxJK
    proxy-authorization: Basic cHJveHktdXNlcjE6SllnVThxUlpWNERZNFBYSmJ4Sks=\r\n
        Credentials: proxy-user1:JYgU8qRZV4DY4PXJbxJK
    host: foobar:9200\r\n
    \r\n
    [Full request URI: http://foobar:9200/]
    [HTTP request 1/4]
    [Response in frame: 17]
    [Next request in frame: 24]

Also the tests at

first.headers().get("authorization"),
and below
appear to be the only place in the vector codebase where hyper_proxy::Proxy:headers() https://github.com/tafia/hyper-proxy/blob/aca1e1f5546ed5530e1a72dc5e07c5ed4b6099b3/src/lib.rs#L228 is called from, even though these are the headers that are populated at Proxy construction time.

References

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugA code related bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions