Hello k6 community,
I am reaching out with a question because I’ve encountered an issue while trying to run tests with k6’s HTTP library. After setting the HTTPS_PROXY environment variable and executing, I receive an error that says Proxy Authentication Required
. Does k6 not pass the headers to the proxy? I believe it should pass them along for the authentication to work properly.
Example
HTTPS_PROXY=http://proxy-server:8080 k6 run test.js --duration=10s -v
import http from "k6/http";
import { sleep, group } from "k6";
export function setup() {
const token =
"eyJraWQiOiIwIiwidH....";
return { token };
}
export default function (data) {
const { token } = data;
group("test1", function () {
console.log(token);
const response = http.get(
`https://test-server.com`,
{
headers: {
"Proxy-Authorization": `Bearer ${token}`,
accept: "*/*"
},
}
);
console.log(response);
sleep(10);
});
}
INFO[0000] Request:
GET / HTTP/1.1
Host: test-server.com
User-Agent: k6/0.43.1 (https://k6.io/)
Accept: */*
Proxy-Authorization: Bearer eyJraWQiOiIwIiwid
group="test" iter=0 request_id=d160f6bf-1aef-479b-59c8-295d4633ecd2 scenario=default source=http-debug vu=1
WARN[0000] Request Failed error="Get \"https://test-server.com\": Proxy Authentication Required"