How to enable bower to work behind a proxy

H

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:

{
  "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:

{
  "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:

{
  "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:

{
  "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

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  • is there a wey to set also a no-proxy setting?
    we have some internal git projects and for that server address bower MUST NOT exit to the proxy.
    Thanks

Tag Cloud

Categories

%d bloggers like this: