I want to access spring-cloud-config-server via proxy backend. Like downloading git repo via http proxy.

Test scenario: I started a local proxy with mitmproxy and provided its details localhost:8080 to my spring boot application's bootstrap.yaml as below: spring.cloud.config.server.git.proxy.http.host=localhost spring.cloud.config.server.git.proxy.http.port=8080

But the server is not going through the proxy. There are no logs in the proxy for this spring boot application. nor when hitting any configuration url nor for downloading the git repo via spring.cloud.config.server.git.uri Spring cloud dependency version : Finchley.SR4

Also tried system variables via -Dhttps.proxyHost and -Dhttps.proxyPort this also not worked for me (I tried using mitmproxy and also tinyproxy)

Please help me here how can this be achieved.

Comment From: ryanjbaxter

Spring Cloud Finchley has reached end of life, please retry with Spring Cloud Hoxton.SR10 or Spring Cloud 2020.0.1.

https://cloud.spring.io/spring-cloud-config/reference/html/#_accessing_backends_through_a_proxy

Comment From: esha-ingle-mpf

Ok sure. However right now, with Finchley, it worked on production with tinyproxy but not locally using the same. I will give it a try with latest version

Comment From: ryanjbaxter

Well if it worked in production but not locally its probably something locally that is misconfigured.

Comment From: esha-ingle-mpf

Well if it worked in production but not locally its probably something locally that is misconfigured.

yeah maybe. will figure it out. Thank you.

Comment From: esha-ingle-mpf

For the proxy, we updated the version and added below 2 properties. it worked spring.cloud.config.server.git.proxy.http.host=localhost spring.cloud.config.server.git.proxy.http.port=8080

However, in my case, I want proxy for one production env and not for others. so when I don't pass these parameters in other envs, my application fails to start giving below error. I have to pass above parameters with dummy values in order to resolve this issue. How can I ignore passing dummy values?

Caused by: java.lang.NullPointerException: null at org.apache.http.impl.client.SystemDefaultCredentialsProvider.getCredentials(SystemDefaultCredentialsProvider.java:114) at org.apache.http.impl.client.AuthenticationStrategyImpl.select(AuthenticationStrategyImpl.java:198) at org.apache.http.impl.client.TargetAuthenticationStrategy.select(TargetAuthenticationStrategy.java:44) at org.apache.http.impl.auth.HttpAuthenticator.handleAuthChallenge(HttpAuthenticator.java:154) at org.apache.http.impl.execchain.MainClientExec.needAuthentication(MainClientExec.java:575) at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:293) at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185) at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89) at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:111) at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:108) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56) at org.eclipse.jgit.transport.http.apache.HttpClientConnection.execute(HttpClientConnection.java:254) at org.eclipse.jgit.transport.http.apache.HttpClientConnection.getResponseCode(HttpClientConnection.java:231) at org.eclipse.jgit.util.HttpSupport.response(HttpSupport.java:205) at org.eclipse.jgit.transport.TransportHttp.connect(TransportHttp.java:498) at org.eclipse.jgit.transport.TransportHttp.openFetch(TransportHttp.java:345) at org.eclipse.jgit.transport.FetchProcess.executeImp(FetchProcess.java:137) at org.eclipse.jgit.transport.FetchProcess.execute(FetchProcess.java:123) at org.eclipse.jgit.transport.Transport.fetch(Transport.java:1269) at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:241) at org.eclipse.jgit.api.CloneCommand.fetch(CloneCommand.java:306) at org.eclipse.jgit.api.CloneCommand.call(CloneCommand.java:200) at org.springframework.cloud.config.server.environment.JGitEnvironmentRepository.cloneToBasedir(JGitEnvironmentRepository.java:574) at org.springframework.cloud.config.server.environment.JGitEnvironmentRepository.copyRepository(JGitEnvironmentRepository.java:549) at org.springframework.cloud.config.server.environment.JGitEnvironmentRepository.createGitClient(JGitEnvironmentRepository.java:532) at org.springframework.cloud.config.server.environment.JGitEnvironmentRepository.refresh(JGitEnvironmentRepository.java:261) ... 73 common frames omitted

Comment From: esha-ingle-mpf

For the proxy, we updated the version and added below 2 properties. it worked spring.cloud.config.server.git.proxy.http.host=localhost spring.cloud.config.server.git.proxy.http.port=8080

However, in my case, I want proxy for one production env and not for others. so when I don't pass these parameters in other envs, my application fails to start giving below error. I have to pass above parameters with dummy values in order to resolve this issue. How can I ignore passing dummy values?

at org.apache.http.impl.client.SystemDefaultCredentialsProvider.getCredentials(SystemDefaultCredentialsProvider.java:114) at org.apache.http.impl.client.AuthenticationStrategyImpl.select(AuthenticationStrategyImpl.java:198) at org.apache.http.impl.client.TargetAuthenticationStrategy.select(TargetAuthenticationStrategy.java:44) at org.apache.http.impl.auth.HttpAuthenticator.handleAuthChallenge(HttpAuthenticator.java:154) at org.apache.http.impl.execchain.MainClientExec.needAuthentication(MainClientExec.java:575) at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:293) at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185) at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89) at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:111) at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:108) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56) at org.eclipse.jgit.transport.http.apache.HttpClientConnection.execute(HttpClientConnection.java:254) at org.eclipse.jgit.transport.http.apache.HttpClientConnection.getResponseCode(HttpClientConnection.java:231) at org.eclipse.jgit.util.HttpSupport.response(HttpSupport.java:205) at org.eclipse.jgit.transport.TransportHttp.connect(TransportHttp.java:498) at org.eclipse.jgit.transport.TransportHttp.openFetch(TransportHttp.java:345) at org.eclipse.jgit.transport.FetchProcess.executeImp(FetchProcess.java:137) at org.eclipse.jgit.transport.FetchProcess.execute(FetchProcess.java:123) at org.eclipse.jgit.transport.Transport.fetch(Transport.java:1269) at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:241) at org.eclipse.jgit.api.CloneCommand.fetch(CloneCommand.java:306) at org.eclipse.jgit.api.CloneCommand.call(CloneCommand.java:200) at org.springframework.cloud.config.server.environment.JGitEnvironmentRepository.cloneToBasedir(JGitEnvironmentRepository.java:574) at org.springframework.cloud.config.server.environment.JGitEnvironmentRepository.copyRepository(JGitEnvironmentRepository.java:549) at org.springframework.cloud.config.server.environment.JGitEnvironmentRepository.createGitClient(JGitEnvironmentRepository.java:532) at org.springframework.cloud.config.server.environment.JGitEnvironmentRepository.refresh(JGitEnvironmentRepository.java:261) ... 73 common frames omitted

Any suggestions here?

Comment From: ryanjbaxter

Can you provide a sample for the failing use case?

Comment From: esha-ingle-mpf

Can you provide a sample for the failing use case?

My bad. Due to cache issues, the spring cloud version is Finchley. This issues occurs for the FInchley version. It is not replicated with latest one.