Apigee Maven plugin behind corporate proxy

Not applicable

Hello All,

I am trying to configure and run Apigee maven plugin for deployment automation. I picked up samples from apigee-edge-maven-plugin and apigee-config-maven-plugin to deploy proxy and configure caches, KVMs, API products etc.

I have configured pom file to have all options and it's all working fine when I run using mvn command line. it only works so far I am not behind corporate network proxy. as soon as I try this from out office network it start failing to connect with apigee management APIs. I checked maven settings.xml and have proxy configured and it can download repository OK(it was giving error when I didn't have proxy configured in settings.xml file).

I checked java configuration it's configured to use proxy settings from my browser.

when I run maven plugin it'g giving me following error

Code Deleted 

I tried using app proxy as well and checked logs in proxy, all calls initiated from plugin to https://api.enterprise.apigee.com/v1 are not hitting proxy at all and failing with timeout error.

Can you please help me to resolve this what I am doing wrong here and why plugin is not picking up proxy configuration?

I have attached pom file for reference shared-pom.txt

Thanks and Regards

Harmeet

0 12 2,173
12 REPLIES 12

Hi Harmeet,

Have you tried passing in the proxy host/port configuration on the mvn command line as in:

mvn -Dhttps.proxyHost=<proxy host or ip> -Dhttps.proxyPort=<portnumber> ...?

Hi @Hansel Miranda


Thanks for suggestion. I just tried this and still not hitting proxy at all.

What I have noticed mvn is picking up proxy config because initially it was failing because couldn't download packages from repository. as soon as I added proxy config in settings.xml it started downloading packages.

I think problem here is with plugin itself when java code trying to connect to Apigee management APIs it doesn't use proxy settings.


Regards

Harmeet

You still need to try it as per Hansel suggestion.

I was in the same situation and assert that it is a right setting for maven plugin.

Maven uses 1 convention of proxy config and maven plugin uses a different one.

See this link for example(s):

https://community.apigee.com/articles/37598/configuring-https-proxy-for-dev-and-runtime-compon.html

Hi @ylesyuk1

I have already added JAVA_FLAGS to environment variables. I can print it fine. also tried to set this from command prompt in same cmd windows and nothing seems to be working.

I am not sure if you work for Apigee, apologies if you are not but if yes Is it possible to have GTM session please?

Thanks

Harmeet

Was any solution found for this issue?

Hi @Francois-Xavier KOWALSKI

Yes this was resolved. I had to set following environment variable

MAVEN_OPTS : -Dhttp.proxyHost=<httpproxyaddresshost> -Dhttp.proxyPort=8080 -Dhttps.proxyHost=<httpsproxyaddresshost> -Dhttps.proxyPort=8080

Thanks

Harmeet

Ok, thanks @harmeet.sra !

Not applicable

For anyone who needs proxy authentication and is serious about security, the suggestions given in this thread are TOTALLY INSECURE.

We submitted PR-83 in September to make the edge plugin use the standard maven proxy configuration (from the settings.xml file). Unfortunately it seems there is little appetite for accepting community contributions as it has been sitting there for 2+ months without any action from maintainers.

If you want to see proper proxy support, perhaps swing over to above GitHub link and vote for the PR or leave your feedback in the comments.

Very much intending to bring the PR in. A vote it not required but happy to get any comments on the changes in the PR. Please comment in the PR thread.

Hi Niels - i am facing same problem. apigee deploy plugin is not able to use proxy to connect api.enterprise.apigee.com.

Do you have any specific suggestion apart of described above. I tried setting proxy as below.

set MAVEN_OPTS -Dhttp.proxyHost=<httpproxyaddresshost> -Dhttp.proxyPort=8080

mvn clean install -Ptest -Dhttp.proxyHost=<httpproxyaddresshost> -Dhttp.proxyPort=8080

both did not work.

Not applicable

Hi, How can I pass Username and Password for the Proxy server? My Proxy server is looking for Basic Auth

If you use a build of the maven plugin that contains the code I submitted in pull request 83 all you need to do is add the standard proxy configuration to your maven settings file. We could not get the official apigee-deploy-maven-plugin to work reliably and securely behind our corporate proxies, hence our effort to fix the maven plugin and contribute the pull request.

NOTE: a lot of the comments above suggest passing in the password via Java -D args. This is considered bad practice and will eventually lead to a loss of your credentials. The native maven process comes with a few features such as encrypted passwords that will ensure your secrets are not floating around the place e.g. in log files, on the CI etc.

Your settings.xml config file would look something like below. Make sure to configure a proxy for both http and https protocols if you happen to have something that still listens on http only (you should not really send passwords in clear text over http in 2018 - but still tend to see some of that).

<settings>
  <proxies>
     <proxy>
      <id>example-proxy</id>
      <active>true</active>
      <protocol>http</protocol>
      <host>proxy.example.com</host>
      <port>8080</port>
      <username>proxyuser</username>
      <password>somepassword</password>
      <nonProxyHosts>www.google.com|*.example.com</nonProxyHosts>
    </proxy>
     <proxy>
      <id>example-proxy</id>
      <active>true</active>
      <protocol>https</protocol>
      <host>proxy.example.com</host>
      <port>8080</port>
      <username>proxyuser</username>
      <password>somepassword</password>
      <nonProxyHosts>www.google.com|*.example.com</nonProxyHosts>
    </proxy>
  </proxies>
  ...
</settings>