How to set up a proxy with TFS4JIRA Synchronizer
As mentioned in https://appfire.atlassian.net/wiki/display/TFS4JIRA/TFS4JIRA+FAQ#TFS4JIRAFAQ-TFS4JIRASynchronizerrefusestoestablishconnectionbecauseofproxy. TFS4JIRA Synchronizer can be used with proxy. There are though additional settings that can be helpful.
Default settings for enabling proxy in Synchronizer are:
<defaultProxy useDefaultCredentials="false">
<proxy usesystemdefault="true" proxyaddress="<proxy address>" bypassonlocal="true" />
</defaultProxy>This line will have to be added to following section to the C:\inetpub\wwwroot\tfs-jira-synchronizer\Web.config (default location of web.config file) file, just before <system.web>
Aside from those, there are multiple scenarios to cover
Adding proxy credentials
No-code solution
Add a value
useDefaultCredentials="true"indefaultProxytag<defaultProxy enabled="true" useDefaultCredentials="true">Go to “Control Panel”\All Control Panel Items\Credential Manager >> Add a Generic Credential
Internet or network address:<yourProxyAddress>
User name:<yourUsername>
Password:<yourPassword>
Code-involved solution
Create an assembly called proxyPass.dll with this class :
namespace SomeNameSpace
{
public class MyProxy : IWebProxy
{
public ICredentials Credentials
{
get { return new NetworkCredential("yourUsername", "yourPassword"); }
set { }
}
public Uri GetProxy(Uri destination)
{
return new Uri("yourProxyAddress");
}
public bool IsBypassed(Uri host)
{
return false;
}
}
}where "yourUsername", "yourPassword" and "yourProxyAddress" are your username, password and proxy address.
Add this file to the bin directory of the TFS4JIRA application.
Add instead of previous settings this line:
<defaultProxy enabled="true" useDefaultCredentials="false">
<module type = "SomeNameSpace.proxyPass, SomeAssembly" />
</defaultProxy>Forcing Synchronizer to not use proxy on some connections
In the <defaultProxy> tag you will have to specify the <bypasslist>
<defaultProxy
enabled="True|False"
useDefaultCredentials="True|False">
<bypasslist>...</bypasslist>
<proxy>...</proxy>
<module>...</module>
</defaultProxy>an example of this kind of setting would look like that:
<configuration>
<system.net>
<defaultProxy>
<bypasslist>
<add address="[a-z]+\.spartez-software\.com$" />
<add address="192\.168\.\d{1,3}\.\d{1,3}" />
</bypasslist>
</defaultProxy>
</system.net>
</configuration>