Developing in companies that have proxy servers for developers can be frustrating in this age when every tool needs access to online resources and even parts of software development life cycle are cloud based. Proxy servers that require NTLM authentication are one of sources of frustration. NTLM is developed by Microsoft but many applications built by Microsoft do not support it or require some configuration and in worst cases some hacking to make it work. Below are the list of some the tools that developers might be using on a daily basis. I keep adding more to the list as I encounter them.
Visual Studio Code (VSCode)
VSCode 1.15 and up now supports NTLM proxy (finally Microsoft supported its own authentication protocol).
For NPM you have two options. Either to send proxy address and credentials in every single command you run or to set them in the global configuration of NPM. I recommend the former because it is more secure.
Set proxy in every command
When calling NPM command you can always use
--proxy switch to set proxy for each command. The syntax for using this switch is the following.
For example to use
myproxy:8080 as proxy address and
my-domain\reza as username and
P@ssw0rd as password when calling the
install command you can type the following.
npm install --proxy http://my-domain%5Creza:P%40ssw0rd@myproxy:8080
Please note that both username and password are URL encoded. You can use the following command in your browser’s developer tools to encode them.
Set proxy in NPM configuration
To set the proxy in the global configuration of NPM you need use the same format as above for sending the proxy address, username and password and use
npm config set to store it in the configuration. For example to set the proxy address to
myproxy:8080 and username to
my-domain\reza and password to
P@ssw0rd you can use the following command.
npm config set proxy http://my-domain%5Creza:P%40ssword@myproxy:8080
Visual Studio, Web Platform Installer and other .NET applications
To set the proxy for pretty much any .NET application, you need to put the following in the configuration file of that application.
<system.net> <defaultProxy useDefaultCredentials="true" enabled="true"> <proxy bypassonlocal="true" proxyaddress="http://myproxy:8080" /> </defaultProxy> </system.net>
For Visual Studio I suggest also enabling IPV6 if the above configuration did not work as suggested by some other developers.
<system.net> <settings> <ipv6 enabled="true"/> </settings> <defaultProxy useDefaultCredentials="true" enabled="true"> <proxy bypassonlocal="true" proxyaddress="http://myproxy:8080" /> </defaultProxy> </system.net>
For executable files the configuration file is named the same as executable’s file name but with .exe.config extension. For Visual Studio it is called
devenv.exe.config and for Web Platform Installer it is