Commit 2624613
committed
logcli: add --proxy-url flag for http/https proxy support
Add `--proxy-url` flag to `logcli` to support connecting to Loki
instances running behind either HTTP or HTTPS CONNECT-style proxies.
Examples:
http proxy:
```
logcli \
--addr="http://loki-distributed-querier.loki.svc.cluster.local.:3100/" \
--proxy-url "http://envoy.dom.tld" \
query '{app"foo"}'
```
https proxy with mTLS auth:
```
logcli \
--addr="https://loki-distributed-querier.loki.svc.cluster.local.:3100/" \
--proxy-url "https://envoy.dom.tld" \
--cert tls.crt \
--key tls.key \
--ca-cert ca.crt \
query '{app"foo"}'
```
Note that tail (`-f`) support and https proxies only works with a fork of the
`gorilla/websocket` lib. There are open PRs that promise to add support
for https proxies such as: gorilla/websocket#740
Add the following to `go.mod` to use the fork with https support:
```
replace github.com/gorilla/websocket v1.4.2 => github.com/philipatl/websocket v1.4.3-0.20211206152948-d16969baa130
```1 parent 7b1ca8d commit 2624613
2 files changed
+23
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
224 | 224 | | |
225 | 225 | | |
226 | 226 | | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
227 | 234 | | |
228 | 235 | | |
229 | 236 | | |
| |||
245 | 252 | | |
246 | 253 | | |
247 | 254 | | |
| 255 | + | |
248 | 256 | | |
249 | 257 | | |
250 | 258 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| 63 | + | |
63 | 64 | | |
64 | 65 | | |
65 | 66 | | |
| |||
191 | 192 | | |
192 | 193 | | |
193 | 194 | | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
194 | 203 | | |
195 | 204 | | |
196 | 205 | | |
| |||
315 | 324 | | |
316 | 325 | | |
317 | 326 | | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
318 | 333 | | |
319 | 334 | | |
320 | 335 | | |
| |||
0 commit comments