Frontend Developer Manual / Version 2010
Table Of Contents
In order that yarn still works behind a proxy server, you need to configure it accordingly.
Because yarn doesn't use the environment variables HTTP_PROXY
and
HTTPS_PROXY
, the proxy settings have to be set manually using the yarn config
command (see the
yarn config documentation
for further details).
yarn config set proxy http://proxy.domain.tld:port yarn config set https-proxy http://proxy.domain.tld:port
Replace proxy.domain.tld
and port
with the address and port of your proxy server. Notice the
dash in the key https-proxy
in contrast to the underscore in the name of the environment
variables.
If your proxy server needs authentication, user name and password can be passed in the URL using the following syntax.
yarn config set proxy http://username:password@proxy.domain.tld:port
If your credentials include an @
symbol, just put your user name and password inside quotes. If you use
any other special characters in your credentials, you have to
convert them into equivalent hexadecimal unicode.
Active Directory users have to pass their credentials in the URL as follows:
yarn config set proxy http://domain\\username:password@proxy.domain.tld:port
Probably, you need to switch the protocol of the used registry from HTTPS to HTTP. Please check Section 5.15, “Changing the Yarn Registry” for further instructions.
Some node modules require files from GitHub, so you would have to configure git
using a proxy in the
same way:
git config --global http.proxy http://username:password@proxy.domain.tld:port git config --global https.proxy http://username:password@proxy.domain.tld:port
Note
Many companies use a proxy auto-config (PAC) file which defines how browsers and other user agents choose the
appropriate proxy server for fetching a given URL. Unfortunately neither yarn
nor git
support
these files. As a workaround, you can install a local proxy server which uses a PAC file to decide how to forward a
request.