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

Disabling a configured proxy for requests to localhost/127.0.0.1/::1. #2305

Merged
merged 3 commits into from May 30, 2016

Conversation

Projects
None yet
2 participants
@dennisoelkers
Member

dennisoelkers commented May 30, 2016

This PR adds a bit of code to disable the proxy in the provider if the target URI containcs localhost, 127.0.0.1 or ::1, because we assume that these are meant to go against the Graylog server host itself and not the proxy host.

@dennisoelkers dennisoelkers added this to the 2.x milestone May 30, 2016

public List<Proxy> select(URI uri) {
switch (uri.getHost().toLowerCase(Locale.ENGLISH)) {
case "localhost":
case "127.0.1":

This comment has been minimized.

@joschi

joschi May 30, 2016

Contributor

Typo?

switch (uri.getHost().toLowerCase(Locale.ENGLISH)) {
case "localhost":
case "127.0.1":
case "::1":

This comment has been minimized.

@joschi

joschi May 30, 2016

Contributor

This will miss non-normalized IPv6 addresses, e. g. "0:0:00::1".

final ProxySelector proxySelector = new ProxySelector() {
@Override
public List<Proxy> select(URI uri) {
switch (uri.getHost().toLowerCase(Locale.ENGLISH)) {

This comment has been minimized.

@dennisoelkers

dennisoelkers May 30, 2016

Member

Good idea. Probably solves all of the remarks :)

This comment has been minimized.

@dennisoelkers

dennisoelkers May 30, 2016

Member

Unfortunately this would rely on InetAddress's usual name resolving, which rules out this solution.

This comment has been minimized.

@joschi

joschi May 30, 2016

Contributor

Why is this a problem (at least for isLoopbackAddress)?

This comment has been minimized.

@dennisoelkers

dennisoelkers May 30, 2016

Member

Hm, due to the fact that we're doing the resolving soon after acquiring the http client provider anyway, it might not be a problem to do this.

@joschi joschi self-assigned this May 30, 2016

dennisoelkers added some commits May 30, 2016

@joschi joschi modified the milestones: 2.0.3, 2.x May 30, 2016

@joschi

This comment has been minimized.

Contributor

joschi commented May 30, 2016

LGTM. 👍

@joschi joschi merged commit 86d998d into master May 30, 2016

4 checks passed

ci-server-integration Jenkins build graylog2-server-integration-pr 942 has succeeded
Details
ci-web-linter Jenkins build graylog-pr-linter-check 430 has succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@joschi joschi deleted the no-proxy-for-localhost branch May 30, 2016

joschi added a commit that referenced this pull request May 30, 2016

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