Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

JIRA REST Client 4.0.0 and http proxy usage ?

Alexander_Piorecki March 15, 2018

Hi,

I'm using the jira-rest-java-client-core 4.0.0 and so far everything has been working just fine (fetching issues, listing, etc.)

However, since my solution is supposed to work in cooperate environment, I need client traffic to go through a HTTP proxy using basic auth.

Unfortunately I fail to see how this can be configurable in the current (latest) JIRA client - even when I try to configure my own (JIRA) httpClient using AsynchronousHttpClientFactory() I cannot provide HttpClientOptions (which actually also does not allow me setting Proxy credentials). And HttpClient does not allow me to configure anything proxy related... so I am kind of stuck...

Do you guys have any example on how to configure this ? I had my hopes up that I could just rely on JIRA client making use of ProxySelector.setDefault(...) - but that does not seem to be the case.

 

Many thanks in advance,

Br

Alex

 

 

2 answers

0 votes
Alexander_Piorecki August 14, 2018

Hey Luca,

I got around the limitation of the API by changing proxy settings for the VM:

...
...
private Properties origProp;
private Properties proxyProp;

// store all the original properties
this.origProp = System.getProperties();

// prepare and overwrite the proxy settings
this.proxyProp = new Properties(origProp);
proxyProp.setProperty("http.proxyHost", "myproxy.com");
proxyProp.setProperty("http.proxyPort", "8080");
proxyProp.setProperty("http.proxyUser", "user);
proxyProp.setProperty("http.proxyPassword", "secret");
proxyProp.setProperty("http.nonProxyHosts", "localhost|127.0.0.1");
proxyProp.setProperty("https.proxyHost", "myproxy.com");
proxyProp.setProperty("https.proxyPort", "8080");
proxyProp.setProperty("https.nonProxyHosts", "localhost|127.0.0.1");
proxyProp.setProperty("https.proxyUser", "user");
proxyProp.setProperty("https.proxyPassword", "secret");
...
...

doJIRAStuff();

...
...

System.setProperties(origProp);
...
...

 

so essentially storing the previous properties, then overwriting them, then setting them, doing JIRA stuff - and finally restoring them.

Its a bit of a hassle as for our network some internal services are not accessible when proxy is enabled so need to enable/disable the proxy for each call. For some reason I couldn't get the nonProxyHosts working ;o(

 

Cheers,

Alex ;o)

0 votes
Lucinda Oll
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 13, 2018

Hey Alexander, I've got the exact same problem. Did you already find a solution for that?
Thanks in advance.

Best wishes Luca

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events