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

Wildcard (*) in NO_PROXY environment variable is not honored #2506

Closed
uklance opened this issue Sep 22, 2020 · 4 comments
Closed

Wildcard (*) in NO_PROXY environment variable is not honored #2506

uklance opened this issue Sep 22, 2020 · 4 comments

Comments

@uklance
Copy link

uklance commented Sep 22, 2020

I need to set my https_proxy environment variable to http://127.0.0.1:3128 for reasons unrelated to kubernetes-client

The following scenario causes an error as kubernetes-client tries to proxy the masterUrl via http://127.0.0.1:3128

The following scenario works since the domain is an exact match (and does not contain asterisk *)

I believe this is related to https://github.com/fabric8io/kubernetes-client/pull/209/files

    private static URL getProxyUrl(Config config) throws MalformedURLException {
        URL master = new URL(config.getMasterUrl());
        String host = master.getHost();
        for (String noProxy : config.getNoProxy()) {
            if (host.endsWith(noProxy)) {
                return null;
            }
        }
        String proxy = config.getHttpsProxy();
        if (master.getProtocol().equals("http")) {
            proxy = config.getHttpProxy();
        }
        if (proxy != null) {
            return new URL(proxy);
        }
        return null;
    }

I think a regular expression is required instead of if (host.endsWith(noProxy)) so that asterisk characters are wildcards

@uklance uklance changed the title Asterisk in NO_PROXY environment does not work Wildcard (*) in NO_PROXY environment variable is not honored Sep 23, 2020
@stale
Copy link

stale bot commented Dec 24, 2020

This issue has been automatically marked as stale because it has not had any activity since 90 days. It will be closed if no further activity occurs within 7 days. Thank you for your contributions!

@stale stale bot added the status/stale label Dec 24, 2020
@stale stale bot closed this as completed Jan 11, 2021
@manusa manusa reopened this Jan 11, 2021
@stale stale bot removed the status/stale label Jan 11, 2021
@cortex93
Copy link

cortex93 commented Feb 8, 2021

I think the behavior here is to be compliant with kubectl client (more or less curl/wget pattern).

So, it is different from usual JAVA pattern.

@tom1299
Copy link

tom1299 commented Feb 9, 2021

Looking at the current implementation of getProxyUrl I'm wondering whether something like wildcards will work. I'm not a regex expert but since contains is used for checking whether the actually host name is in a no proxy entry I would say that something like *.mydomain.com and test-api.mydomain.com will not work. What do you think ?

@stale
Copy link

stale bot commented May 10, 2021

This issue has been automatically marked as stale because it has not had any activity since 90 days. It will be closed if no further activity occurs within 7 days. Thank you for your contributions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants