Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using proxy for Insights #1062

Closed
micsjo opened this issue Jun 27, 2019 · 7 comments
Closed

Using proxy for Insights #1062

micsjo opened this issue Jun 27, 2019 · 7 comments
Labels

Comments

@micsjo
Copy link
Contributor

micsjo commented Jun 27, 2019

Using k6 locally in a restricted network and sending data to Load Impact Insights or the "-o cloud" option is a very good solution.

However, restricted network often means internet access (if any) is usually by proxy.

We would like to have a way to specify a proxy for the cloud (or Insights) output only that will not impact the requests generated.

@na--
Copy link
Member

na-- commented Jun 27, 2019

It should be fairly simple to just add a proxy config option for the Load Impact Insights output, via a K6_CLOUD_PROXY environment variable or something like that. But then, are we going to have to repeat this exercise for every single output, since it could be argued that there's a similar use case for them as well? That would definitely be cumbersome and would exacerbate the current configuration issues (#883, #587)...

A workaround (that's also far from ideal) when we have the custom transports would be to set a global proxy via HTTP_PROXY environment variable (that would be used by the outputs) and an explicit no-proxy transport for the actual load test.

@micsjo
Copy link
Contributor Author

micsjo commented Jul 18, 2019

You could honor the NO_PROXY header as well, such as curl does it curl proxy headers

@na--
Copy link
Member

na-- commented Jul 18, 2019

Hm it actually seems like we already do! We use the http.ProxyFromEnvironment and it seems to support NO_PROXY:

ProxyFromEnvironment returns the URL of the proxy to use for a given request, as indicated by the environment variables HTTP_PROXY, HTTPS_PROXY and NO_PROXY (or the lowercase versions thereof). HTTPS_PROXY takes precedence over HTTP_PROXY for https requests.
...
A nil URL and nil error are returned if no proxy is defined in the environment, or a proxy should not be used for the given request, as defined by NO_PROXY.

@micsjo
Copy link
Contributor Author

micsjo commented Jul 18, 2019

I noticed when I was looking into the code that you were using the standard golang implementation for the proxy settings which includes the NO_PROXY setting. I have just validated that it works as expected.

So this issue is simpler than fixing code, it's apparently enough to fix the documentation :-)

@na--
Copy link
Member

na-- commented Jul 18, 2019

Yep, tagged it as such 👍 😄 Thanks again!

@pawansinha0612

This comment has been minimized.

@na--
Copy link
Member

na-- commented Jan 27, 2021

Closing this in favor of grafana/k6-docs#74, given that the docs now live in their own repo.

@na-- na-- closed this as completed Jan 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants