Skip to content

Support HTTP_PROXY for LogCLI #11742

Closed
@RamblingCookieMonster

Description

@RamblingCookieMonster

Is your feature request related to a problem? Please describe.

LogCLI ignores the standard HTTP_PROXY environment variable. (and related, NO_PROXY, etc., but the focus of this is on specifying a proxy). Many existing processes and environments use these variables intentionally, without expectation that one must set an application-specific flag like --proxy-url.

Describe the solution you'd like

Support HTTP_PROXY. Keeping the existing flag and default from an application specific variable is fine, but I would encourage you to look at the HTTP_PROXY as a third step down the precedence ladder. Find --proxy-url? use that. No --proxy-url but find LOKI_HTTP_PROXY_URL? Use that. Find none of the above, but HTTP_PROXY is set? Use that.

The current flag parsing is here.

Yes, this could be a breaking change. A hypothetical:

  • A customer has a self-hosted Loki that does not need a proxy to access it.
  • They use logcli on a system that has HTTP_PROXY set.
  • Their proxy cannot hit their Loki instance.

Assuming (1) they do not use NO_PROXY and/or logcli does not pick up that env var, the proposed change to logcli would set a proxy, and their logcli queries would hit their proxy which cannot hit Loki.

I'm a bit indifferent and suggest that this would be on them (to review a new logcli for breaking changes, etc.). But, you might consider, in order of my personal preference, a --ignore-http-proxy flag to ignore that env var if it exists, or, less ideal, a --use-http-proxy flag that tells logcli to use that env var if it exists and is not overridden with --proxy-url. Or something.

Describe alternatives you've considered

I can set this with the logcli-specific environment variable or flag. It's just not ideal or keeping with standard software / CLI building practices. With that said, I'd like to be able to give examples of using LogCLI in our environment without spelling out "sorry, logcli will ignore HTTP_PROXY, you'll need to take note of whether the system you use needs a proxy, and use --proxy-url as appropriate."

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions