VictoriaMetrics/app/vmauth
Aliaksandr Valialkin 4e3acfbe9a
app/vmauth: properly proxy HTTP requests without body
The Request.Body for requests without body can be nil. This could break readTrackingBody.Read() logic,
which could incorrectly return "cannot read data after closing the reader" error in this case.
Fix this by initializing the readTrackingBody.r with zeroReader.

While at it, properly set Host header if it is specified in 'headers' section.
It must be set net/http.Request.Host instead of net/http.Request.Header.Set(),
since the net/http.Client overwrites the Host header with the value from req.Host
before sending the request.

While at it, add tests for requestHandler(). Additional tests for various requestHandler() cases
will be added in future commits.

Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/6445
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/5707
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/5240
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/pull/6525
2024-07-19 16:26:07 +02:00
..
deployment app/vmauth: add initial version of vmauth. See https://github.com/VictoriaMetrics/VictoriaMetrics/blob/master/app/vmauth/README.md for details 2020-05-05 10:56:20 +03:00
multiarch deployment: build image for vmagent streamaggr benchmark (#6515) 2024-06-24 16:29:14 +02:00
auth_config.go app/vmauth: properly proxy HTTP requests without body 2024-07-19 16:26:07 +02:00
auth_config_test.go app/vmauth: properly proxy HTTP requests without body 2024-07-19 16:26:07 +02:00
example_config.yml app/vmauth: adds metric_labels and backend_errors counter (#5585) 2024-01-22 01:09:51 +02:00
example_config_ent.yml vmauth: add browser authorization request for http requests without… (#5234) 2023-11-01 21:00:52 +01:00
main.go app/vmauth: properly proxy HTTP requests without body 2024-07-19 16:26:07 +02:00
main_test.go app/vmauth: properly proxy HTTP requests without body 2024-07-19 16:26:07 +02:00
Makefile Add build support for loong64 (#6222) 2024-05-10 14:32:05 +02:00
README.md all: replace old https://docs.victoriametrics.com/vmauth.html url with the new one - https://docs.victoriametrics.com/vmauth/ 2024-04-18 01:50:16 +02:00
target_url.go app/vmauth: follow-up for b155b20de4 2024-04-17 14:53:20 +02:00
target_url_test.go app/vmauth: properly handle the case when zero backend hosts are resolved at SRV DNS 2024-07-17 11:34:33 +02:00

See vmauth docs here.

vmauth docs can be edited at docs/vmauth.md.