Hi there, in this post I will show you how to configure bower so it can download files behind a proxy.
In your project root folder, create a file ‘.bowerrc‘. In that file, add the following lines:
1 2 3 4 |
{ "proxy": "http://<url>:<port>", "https-proxy": "http://<url>:<port>" } |
Change the <url> to the proxy url and the <port> to the proxy port. for example a proxy can look like:
1 2 3 4 |
{ "proxy": "http://proxy.laurenthinoul.com:1234", "https-proxy": "http://proxy.laurenthinoul.com:1234" } |
NOTE! Make sure that your url start with http in the https-proxy section! Example: “https-proxy“: “http://proxy.laurenthinoul.com:1234″.
When you need to give your credentials to a proxy server. User the following code in your .bowerrc file:
1 2 3 4 |
{ "proxy": "http://<username>:<password>@<url>:<port>", "https-proxy": "http://<username>:<password>@<url>:<port>" } |
Change the <username> to your username and the <password> to your password. An example:
1 2 3 4 |
{ "proxy": "http://laurenthinoul:pwdl@proxy.laurenthinoul.com:1234", "https-proxy": "http://laurenthinoul:pwdl@proxy.laurenthinoul.com:1234" } |
Hopefully this post is useful to you! If it does, like ‘n’ share 😀 happy coding!
1 comment for “How to enable bower to work behind a proxy”