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

Spring Boot app with Azure App Configuration - doesn't work behind corporate firewall / doesn't pick proxy settings #656

Closed
JJustas opened this issue Mar 30, 2020 · 8 comments
Assignees

Comments

@JJustas
Copy link

JJustas commented Mar 30, 2020

Current Behavior / Steps to reproduce

I have created simple Spring Boot app with Azure App Configuration lib according to Create a Java Spring app with Azure App Configuration. I use Spring Boot v2.2.5.RELEASE and

    <dependency>
        <groupId>com.microsoft.azure</groupId>
        <artifactId>spring-cloud-azure-appconfiguration-config</artifactId>
        <version>1.2.2</version>
    </dependency>

When I try to run the app, console outputs logo and version:

    /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
    ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
     \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
      '  |____| .__|_| |_|_| |_\__, | / / / /
     =========|_|==============|___/=/_/_/_/
     :: Spring Boot ::        (v2.2.5.RELEASE)

It stops for a few mins and then throws:

    java.lang.RuntimeException: Max retries 12 times exceeded. Connection timed out: no further information: appconfigtest.azconfig.io:ip_address:443
    
    ...
    
    Caused by: io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection timed out: no further information: appconfigtest.azconfig.io:ip_address:443
    Caused by: java.net.ConnectException: Connection timed out: no further information

Configured proxy settings using VM args (-Dhttps.proxyHost, -Dhttps.proxyPort, -Dhttp.nonProxyHosts), it gives effect for other sites but for this case didn't help.

When I try access the same App Config from the same machine using Azure CLI, .NET Core, Azure Functions in .NET core, it works well and displays the values. If I deploy the same Spring Boot app to the cloud, it also works well.

Possible Solution

The issue seems to be the same as appconfiguration-config does not pick up proxy setting. However, I use the latest library but the problem still exists.

@mssfang
Copy link
Member

mssfang commented Apr 10, 2020

@JJustas what is the connection type you are using? We have been looking at the issue. We are unable to reproduce the issue. Any further information about how you set up your proxy would be helpful.

@mssfang
Copy link
Member

mssfang commented Apr 10, 2020

SDK provided a way to setup the proxy options when building a client. I created a PR that shows the sample for how to use it. Azure/azure-sdk-for-java#10097

@JJustas
Copy link
Author

JJustas commented Apr 12, 2020

Thanks but it should pick proxy settings automatically if any provided - it would be more convenient and save time for others.

@mssfang
Copy link
Member

mssfang commented Apr 14, 2020

Azure Core 1.2.3 has support it already. (the latest App Config SDK 1.1.1 use Azure Core 1.2.3)
We support (https://azure.github.io/azure-sdk/general_azurecore.html#environment-variables)

  • HTTP_PROXY // Proxy for HTTP connections
  • HTTPS_PROXY // Proxy for HTTPS connections
  • NO_PROXY // Hosts which must not use a proxy

and (https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/core/azure-core/src/main/java/com/azure/core/http/ProxyOptions.java#L52)

  • https.proxyHost,
  • https.proxyPort
  • http.nonProxyHosts
private static final List<Function<Configuration, ProxyOptions>> ENVIRONMENT_LOAD_ORDER = Arrays.asList(
    configuration -> attemptToLoadAzureProxy(configuration, Configuration.PROPERTY_HTTPS_PROXY),  //HTTPS_PROXY
    configuration -> attemptToLoadAzureProxy(configuration, Configuration.PROPERTY_HTTP_PROXY),  //HTTP_PROXY
    configuration -> attemptToLoadJavaProxy(configuration, HTTPS),  //Java https.*
    configuration -> attemptToLoadJavaProxy(configuration, HTTP)  //Java http.*
);

as well.

@mrm9084
Copy link
Collaborator

mrm9084 commented May 14, 2020

@MrOstling
Copy link

We are having a similar issue with using Evenhub behind a corporate firewall. It seems that I can set the proxy information via the configuration once I update to com.azure:azure-messaging-eventhubs:5.1.0, but I can't seem to figure out how to set the transportType to AmqpWebSockets. This causes an exception. It appears that DefaultEventHubClientFactory creates new EventHubClientBuilders and doesn't have a mechanism to set the transporType. If someone could add transportType to the AzureEventHubProperties and pass it along to the clientBuilders through the clientFactory that might solve the issue.

I was having trouble overwriting the clientFactory bean in our application to do this very thing. It seems that AzureEventHubAutoConfiguration is forcibly imported in EventHubBinderConfiguration which prevents our bean from being used. For some reason when we duplicate EventHubBinderConfiguration in our app to resolve the bean issue we loose the ability to publish/read from multiple eventhub namespaces.

@yiliuTo
Copy link
Member

yiliuTo commented May 21, 2020

@MrOstling, we have opened a new issue for your problem, and you can follow it #702 up.

@mrm9084
Copy link
Collaborator

mrm9084 commented Jun 25, 2020

Is fixed as of version 1.x.5. Let us know if their are any additional issues.

@mrm9084 mrm9084 closed this as completed Jun 25, 2020
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

6 participants