Bower calls blocked by corporate proxy - proxy

I'm trying to use Bower for a web app, but find myself hitting some sort of proxy issues:
D:\>bower search jquery
bower retry Request to https://bower.herokuapp.com/packages/search/jquery failed with ECONNRESET, retrying in 1.2s
bower retry Request to https://bower.herokuapp.com/packages/search/jquery failed with ECONNRESET, retrying in 2.5s
bower retry Request to https://bower.herokuapp.com/packages/search/jquery failed with ECONNRESET, retrying in 6.8s
bower retry Request to https://bower.herokuapp.com/packages/search/jquery failed with ECONNRESET, retrying in 15.1s
bower retry Request to https://bower.herokuapp.com/packages/search/jquery failed with ECONNRESET, retrying in 20.3s
bower ECONNRESET Request to https://bower.herokuapp.com/packages/search/jquery failed: tunneling socket could not be established, cause=Parse Error
Relevant points:
I can browse to https://bower.herokuapp.com/packages/search/jquery and it returns a full json response.
I can use git to clone, both using the git:// protocol and http(s).
I can use NPM directly without these issues
I've tried using Fiddler to determine what's being blocked, but it doesn't detect any calls from the Bower command. I can see calls from NPM commands in Fiddler.
I've searched the Bower issues list, seen similar issues, but they either have no solution or it doesn't seem quite the same as mine.
Any ideas?

Thanks #user3259967
This did the job.
I would like to add that if you are behind a proxy that needs to be authenticated, you can add the username/password to your .bowerrc file.
{
"directory": "library",
"registry": "http://bower.herokuapp.com",
"proxy":"http://<USERNAME>:<PASSWORD>#<PROXY_IP>:<PROXY_PORT>/",
"https-proxy":"http://<USERNAME>:<PASSWORD>#<PROXY_IP>:<PROXY_PORT>/"
}
NOTICE the use of http:// in https-proxy

The solution for me is this config .bowerrc
{
"directory": "vendor",
"registry": "http://bower.herokuapp.com",
"proxy": "http://<user>:<pwd>#proxy.host.br:8080",
"https-proxy": "http://<user>:<pwd>#proxy.host.br:8080",
"strict-ssl": false
}
Using the http protocol in https-proxy plus registry entry with http protocol.
Remember to change 8080 port number to whatever is yours proxy server port.

Are you behind a proxy?
Have you set up environment variables HTTP_PROXY and HTTPS_PROXY?
SET HTTP_PROXY=http://yourproxyserver:yourproxyport
SET HTTPS_PROXY=http://yourproxyserver:yourproxyport

Try changing the registry value in your .bowerrc:
{
"registry": "http://bower.herokuapp.com"
}

I did not have a .bowerrc file to configure my bower settings. I found the settings living in a file called defaults.js. found under "C:\...\bower\node_modules\bower-config\lib\util\defaults.js"
I hope this helps others:
var defaults = {
'cwd': process.cwd(),
'directory': 'bower_components',
'registry': 'http://bower.herokuapp.com',
'shorthand-resolver': 'git://github.com/{{owner}}/{{package}}.git',
'tmp': paths.tmp,
'proxy': '<<http://user:pass#proxy:port>>', // change proxy here or at the top
'https-proxy': '<<http://user:pass#proxy:port>>', // change proxy here or at the top
'timeout': 30000,
'ca': { search: [] },
'strict-ssl': false,
'user-agent': userAgent,
'color': true,
'interactive': null,
'storage': {
packages: path.join(paths.cache, 'packages'),
links: path.join(paths.data, 'links'),
completion: path.join(paths.data, 'completion'),
registry: path.join(paths.cache, 'registry'),
empty: path.join(paths.data, 'empty') // Empty dir, used in GIT_TEMPLATE_DIR among others
}
};
module.exports = defaults;

you can try suggest #thebignet into same issue on GitHub
Set proxy, https-proxy and strict-ssl configuration into .bowerrc File :
{
"proxy" : "http://<host>:<port>",
"https-proxy" : "http://<host>:<port>",
"strict-ssl" : false
}
But you must run Command from terminal:
git config --global url."https://".insteadOf git://

"strict-ssl": false
in .bowerrc did for me

For Win 7.
What worked for me , are below steps as suggested at this link - read #nanowizard answer.
In .bowerrc file, remove any http_proxy / https_proxy settings that
you might have done earlier. This is important.
So final content of this file should look like :-
{
"directory": "app/bower_components"
}
Set environment variables in your pc - http_proxy and https_proxy to your corporate firewall proxy. In case, your corporate proxy requires authentication and if your password contains special characters, convert it to hex form as suggested by this link. As in my case escaping of characters with '\' did not help. Also I had to restart my system.
Note :
http_proxy and https_proxy should contain same proxy address as shown below
http_proxy = http://<user>:<password>#<your company proxy>:<port>
https_proxy= http://<user>:<password>#<your company proxy>:<port> ->Note no 's' in http://...

I am behind corporate firewall and I have to specify domain name too.
None of these answers worked for me. Here is what I did -
Downloaded CNTLM from http://cntlm.sourceforge.net/
Obviously installed it.
Open up cntml.ini and change the following
Domain your_domain_name
Username your_domain_username
Password your_domain_passowrd
PassLM 1AD35398BE6565DDB5C4EF70C0593492 (uncomment this)
PassNT 77B9081511704EE852F94227CF48A793 (uncomment this too)
Proxy http://localhost:8888
Go to services.msc and start the CNTLM Authentication service.
Download Fiddler 4/2 (whatever they call it).
Install this too. This will run in http://localhost:8888
Now whatever program you’re running forward(proxy) it to http://locahost:3128 ( that’s what CNTLM is running.)
In this case specify http.proxy and https.proxy as http://localhost:8888
This will work for other client programs. Just specify proxy as http://localhost:8888

its work for me to change in .bowerrc file
{
"directory": "client/lib",
"registry": "http://bower.herokuapp.com",
"proxy":"http://192.168.1.205:3228",
"https-proxy":"http://192.168.1.205:3228"
}
where client/lib is installation directory where do you want to install
and http://192.168.1.205:3228 is your proxy ip with port. corporate proxy can be different according to oraganization.

In addition to setting the below proxy in .bowerrc:
{
"directory": "app/bower_components",
"proxy":"http://<user>:<password>#proxy.company.com:<proxy-port>",
"https-proxy":"http://<user>:<password>#proxy.company.com:<proxy-port>",
"http-proxy":"http://<user>:<password>#proxy.company.com:<proxy-port>",
"strict-ssl": false,
"registry": "http://bower.herokuapp.com"
}
I am required to run the following commands to fix the issue:
npm cache clean
bower cache clean
bower install

The registry used in the the other answers is now deprecated. Please update it!
{
"proxy":"http://<user>:<password>#proxy.company.com:<proxy-port>",
"https-proxy":"http://<user>:<password>#proxy.company.com:<proxy-port>",
"registry": "https://registry.bower.io"
}

{
"directory": "library",
"registry": "http://bower.herokuapp.com",
"proxy":"http://<USERNAME>:<PASSWORD>#<PROXY_IP>:<PROXY_PORT>/",
"https-proxy":"http://<USERNAME>:<PASSWORD>#<PROXY_IP>:<PROXY_PORT>/"
}
This code worked for me. I am using Win 7 and chrome and also git bash. Here few things need to be cleared. This takes me huge time to find the actual data regarding the user name, password, proxy IP and Port. I will describe it step by step so that every learners can easily grasp the message:
Create a file in the notepad named .bowerrc in the login folder; You can go there by typing at Start>Run>%UserProfile% and press OK.
Type above code in the .bowerrc file with the following changes:
Replace <USERNAME> with your internet connection user ID or login ID
Replace <PASSWORD> with your internet connection password or login password.
Replace <PROXY_IP> and <PROXY_PORT> with the working proxy IP address and its port number.
**Note: There should be no angle brackets.**
Proxy IP should be different than your own IP.
Before using any proxy IP and port you should check it is working by changing your proxy IP and port.
You can go through this link to know the details of proxy settings at description here
From this proxy settings you will get Proxy IP and Port.
Recheck all the input so that all are correct and save and close the file.
Open git bash and change directory to the project file and type command and hit enter, in my case, git bash command:
a#a-PC MINGW32 /d/conFusion
$ bower install
It worked like magic.

In case it helps someone, I had a 'bower blocked by group policy' error.
Solution was to make an exception in CryptoPrevent, a application installed on our company computers to prevent crypto lockers.

For info, in your .bowerrc file you can add a no-proxy attribute. I don't know since when it is supported but it works on bower 1.7.4 and it solve the issue of bower behind a corporate proxy with an internal repository
.bowerrc :
{
"directory": "bower_components",
"proxy": "http://yourProxy:yourPort",
"https-proxy":"http://yourProxy:yourPort",
"no-proxy":"myserver.mydomain.com"
}
Regards

Please make sure there are no special characters in your proxy password. Convert it to hex. It works for me.

Related

secure-http flag in a composer.json doesn't work

I need to use http composer registry for several packages:
...
"repositories":[
{"type":"composer", "url":"http://<url>"}
],
"secure-http":false,
...
But when I am trying to composer update to update lock file, I got:
[Composer\Downloader\TransportException]
Your configuration does not allow connection to http://<url>.
See https://getcomposer.org/doc/06-config.md#secure-http for details.
By responding url I found next information;
secure-http#
Defaults to true.
If set to true only HTTPS URLs are allowed to be downloaded via Composer.
If you really absolutely need HTTP access to something then you can disable it ...
So I am confused what I am doing wrong.
Wrong composer.json structure. secure-http must be in the config section:
{
...,
"config":{
...,
"secure-http":false,
...
}
...
}
Hey you could make it a global thorough writing :
composer config -g secure-http false

Server not available on Parse Server Dashboard

I've setup Parse Server Dashboard on my local machine, and followed the instructions to connect to my Parse Server which is hosted on Heroku.
The Server URL I use to connect to Heroku in my iOS is:
https://my-app-name.herokuapp.com/parse
, so I used this for the Dashboard also.
My config settings are:
{
"apps": [
{
"serverURL": "https://my-app-name.herokuapp.com/parse",
"appId": "appId",
"masterKey": "masterKey",
"appName": "appName"
}
]
}
, however I am getting the error "Server not reachable. Could not connect to server".
When I remove the https://, I get the error "Server not reachable. Server version too low."
The version is 2.1.4, which is the minimum requirement for the Dashboard.
Any suggestions please?
Thanks!
Make sure the config vars (APP_ID, MASTER_KEY, SERVER_URL) between your Parse server and dashboard are set identically. Use https:// instead of http:// for both SERVER_URLs.
To verify your config vars are the same:
Go to your Heroku dashboard
Open both your Parse Server and Dashboard in new tabs
Go to each respective setting tab
Click the Reveal Config Vars button under Config Vars and verify that APP_ID, MASTER_KEY, SERVER_URL are identical for both apps.
Try following these two steps:
npm install -g parse-dashboard
Then
parse-dashboard --appId yourAppId --masterKey yourMasterKey --serverURL "https://example.com/parse" --appName optionalName
The URL should not contain double quotation marks

jhbuild build throwing 407 authentication error

I'm trying to install jhbuild. When I give jhbuild build command it gives me error -
jhbuild build: could not download https://git.gnome.org/browse/jhbuild/plain/modulesets/gnome-apps-3.18.modules: <urlopen error Tunnel connection failed: 407 Proxy Authentication Required>
I'm behind a college proxy and Ubuntu 14.04. How do I find a way around this problem?
Probably your college proxy has some kind of authentication. Put the correct proxy settings in environment by adding this
export http_proxy="http://[username]:[password]#[proxy.server.com]:[port]"
export https_proxy="http://[username]:[password]#[proxy.server.com]:[port]"
in your .bashrc or any other init configuration files. Even after if it shows the same error, I came across a good tool proGY (An intermediate proxy authenticator).
Also you will have to set your proxy url as above in git config also
git config --global http.proxy http://[username]:[password]#[proxy.server.com]:[port]
git config --global https.proxy http://[username]:[password]#[proxy.server.com]:[port]
If you college doesn't have other open ports as git protocol uses it, you should explicitly say jhbuild to use http:// git clone urls instead of git:// clone URLS.
repos['git.gnome.org'] = 'https://git.gnome.org/browse/'
repos['git.freedesktop.org'] = 'http://anongit.freedesktop.org/git/'
repos['wayland.freedesktop.org'] = 'http://anongit.freedesktop.org/git/wayland'
repos['gstreamer.freedesktop.org'] = 'http://anongit.freedesktop.org/git/gstreamer'
repos['pulseaudio.freedesktop.org'] = 'http://anongit.freedesktop.org/git/pulseaudio'
repos['telepathy.freedesktop.org'] = 'http://anongit.freedesktop.org/git/telepathy'
repos['modemmanager.freedesktop.org'] = 'http://anongit.freedesktop.org/git/ModemManager'
repos['git.savannah.nongnu.org'] = 'http://git.savannah.gnu.org/r/'
repos['github.com'] = 'https://github.com/'
in your jhbuildrc file (in ~/.config/jhbuildrc)

Gradle can't resolve dependencies through my http proxy

when I try to run gradle dependencies on my computer I am getting a 407 status code "Proxy Authentication Required."
I created a gradle.properties file in my %GRADLE_HOME% directory. gradle.properties contains the following entries:
systemProp.proxySet='true'
systemProp.http.proxyHost=http-proxy.nwie.net
systemProp.http.proxyPort=8080
systemProp.http.proxyUser=%myUserNameHere%
systemProp.http.proxyPassword=%myPasswordHere%
I can successfully get through my proxy for ruby gems by setting HTTP_PROXY to the following value:
http://%myUserNameHere%:%myPasswordHere%#http-proxy.nwie.net:8080
I am using gradle-1.3, please let me know if there is something I am missing.
Thanks in advance!
UPDATE:
I tried setting systemProp.http.proxyUser to a new value in domain/username format. Below are my current properties file contents:
systemProp.proxySet=true
systemProp.http.proxyHost=http-proxy.nwie.net
systemProp.http.proxyPort=8080
systemProp.http.proxyUser=http-proxy.nwie.net/%USERNAME%
systemProp.http.proxyPassword=%PASSWORD%
I am currently getting the same error message I found initially.
Some dependencies are fetched from servers that run over HTTPS so you need to specify values for https properties as well:
systemProp.https.proxyHost=http-proxy.nwie.net
systemProp.https.proxyPort=8080
systemProp.https.proxyUser=http-proxy.nwie.net/%USERNAME%
systemProp.https.proxyPassword=%PASSWORD%
Is it an NTLM proxy (Usually found in a windows environment with active directory). If so, You may have to specify the domain name with the username in the format domain/username.
Take a look at this link.
http://www.gradle.org/docs/current/userguide/build_environment.html

Gradlew behind a proxy

I have a sample from Gaelyk (called Bloogie) and it is using gradlew.
I am behind a proxy.
I've read gradle docs and found this:
gradle.properties
systemProp.http.proxyHost=www.somehost.org
systemProp.http.proxyPort=8080
systemProp.http.proxyUser=userid
systemProp.http.proxyPassword=password
But I have no clue how to put this info into the wrapper gradlew. Any idea?
All you have to do is to create a file called gradle.properties (with the properties you mentioned above) and place it under your gradle user home directory (which defaults to USER_HOME/.gradle) OR in your project directory.
Gradle (the wrapper too!!!) automatically picks up gradle.properties files if found in the user home directory or project directories.
For more info, read the Gradle user guide, especially at section 12.3: Accessing the web via a proxy
If you need https access behind a proxy, please consider defining also the same set of properties for systemProp.https.
systemProp.https.proxyHost=www.somehost.org
systemProp.https.proxyPort=8080
See Can't build Android app using crashlytics behind VPN and proxy for more information.
Add the below in your gradle.properties file and in your gradle/wrapper/gradle-wrapper.properties file if you are downloading the wrapper over a proxy
If you want to set these properties globally then add it in USER_HOME/.gradle/gradle.properties file
## Proxy setup
systemProp.proxySet=true
systemProp.http.keepAlive=true
systemProp.http.proxyHost=host
systemProp.http.proxyPort=port
systemProp.http.proxyUser=username
systemProp.http.proxyPassword=password
systemProp.http.nonProxyHosts=local.net|some.host.com
systemProp.https.keepAlive=true
systemProp.https.proxyHost=host
systemProp.https.proxyPort=port
systemProp.https.proxyUser=username
systemProp.https.proxyPassword=password
systemProp.https.nonProxyHosts=local.net|some.host.com
## end of proxy setup
Use this in prompt line:
gradle -Dhttp.proxyHost=*** -Dhttp.proxyPort=*** -Dhttp.proxyUser=**** -Dhttp.proxyPassword=****
Works here!
I could not get the proxy property to work until I set the https proxy:
systemProp.https.proxyHost=www.somehost.org
systemProp.https.proxyPort=8080
However I had to use the http property for user name and password:
systemProp.http.proxyUser=userid
systemProp.http.proxyPassword=password
This problem with the Gradle Wrapper has been fixed with Gradle 1.0-milestone-8. Give it a shot.
after of this JDK update, I couldn't use gradlew behind a proxy again.
and finally I found a JDK has disabled Basic authentication for HTTPS tunneling by default.
so I have to add this property for gradle.properties in addition to proxy settings
systemProp.jdk.http.auth.tunneling.disabledSchemes=""
I hope it would be helpful for someone who struggle same problem
To add more nuances, for my case, when I have multiple gradle.properties files in both USER_HOME/.gradle and the project root, I encountered the authenticationrequired 407 error, with the bellow log: CONNECT refused by proxy: HTTP/1.1 407 authenticationrequired
This caused my systemProp.https.proxyPassword and systemProp.http.proxyPasswordblank in the gradle.properties file under USER_HOME/.gradle, while the gradle.properties file under the project root remained password info. Not sure the exact reason, But when I remove one gradle.properties in the project root and keep the file in the USER_HOME/.gradle, my case is resolved.
I had same problem and first thing I did was to create gradle.properties. I had not such as file so I should create it with following content:
systemProp.http.proxyHost=proxy
systemProp.http.proxyPort=port
systemProp.http.nonProxyHosts=domainname|localhost
systemProp.https.proxyHost=proxy
systemProp.https.proxyPort=port
systemProp.https.nonProxyHosts=domainname|localhost
When I added them gradlew command works properly behind corporate proxy. I hope that it can be useful.
I was found that reading of properties from gradle.properties can be incorrect. In case line contains trail white space, gradle cannot find proxy. check your proxy file and cut whitespace at the end of line. Can be help
This was not working for me at first.
In my case, I had created what I thought was a USER_HOME/.gradle/gradle.properties file but ended up with a gradle.properties.txt file.
From the terminal window an ls command will show the full file names in the .gradle folder.
Then mv gradle.properties.txt gradle.properties
I have the same proxy issue while working with Cordova project.
To fix the issue, I have created a new gradle.properties file under the android folder of my Cordova project (hello/platforms/android), and added the code from your question
systemProp.http.proxyHost=proxy.yourproxysite.com
systemProp.http.proxyPort=8080
systemProp.http.proxyUser=yourusername
systemProp.http.proxyPassword=password
Setting SSl proxy worked for me.
systemProp.http.proxyHost=proxy.yourproxysite.com
systemProp.http.proxyPort=8080
systemProp.https.proxyHost=proxy.yourproxysite.com
systemProp.https.proxyPort=8080
An excerpted answer from the linked thread below. It shows how to do
this more programtically. Hope it helps
task setHttpProxyFromEnv {
def map = ['HTTP_PROXY': 'http', 'HTTPS_PROXY': 'https']
for (e in System.getenv()) {
def key = e.key.toUpperCase()
if (key in map) {
def base = map[key]
//Get proxyHost,port, username, and password from http system properties
// in the format http://username:password#proxyhost:proxyport
def (val1,val2) = e.value.tokenize( '#' )
def (val3,val4) = val1.tokenize( '//' )
def(userName, password) = val4.tokenize(':')
def url = e.value.toURL()
//println " - systemProp.${base}.proxy=${url.host}:${url.port}"
System.setProperty("${base}.proxyHost", url.host.toString())
System.setProperty("${base}.proxyPort", url.port.toString())
System.setProperty("${base}.proxyUser", userName.toString())
System.setProperty("${base}.proxyPassword", password.toString())
}
}
}
See this thread for more
After lots of struggling with this and banging my head against a wall, because nothing on my system was using a proxy: it turned out that my ** Android Emulator instance ** itself was secretly/silently setting a proxy for me via Android Emulator > Settings > Proxy and had applied these settings when playing around with it weeks earlier in order to troubleshoot an issue with Expo.
If anyone is having this issue, make sure you check 100% to see if indeed no custom proxy settings are being used via: ./gradlew installDebug --info --debug --stacktrace and searching for proxyHost in the log output to make sure of this. It may be your emulator.
The following applies when your gradle archive is mirrored behind the firewall (like mine..):
For some reason, I needed both of these lines:
gradle.properties:
systemProp.http.nonProxyHosts=*.localserver.co
systemProp.https.nonProxyHosts=*.localserver.co
EVEN though my download line started with https, such as below:
gradle-wrapper.properties:
distributionUrl=https\://s.localserver.co/gradle-7.0.1-bin.zip
It wasn't working in ANY other way... except only it worked if I used export JAVA_OPTS=-Dhttp.nonProxyHosts=localserver.co|etc.
Even though my environment variable no_proxy was already correctly set, it wasn't working without the two values in the above properties.
systemProp.http.proxyUser=userId
systemProp.http.proxyPassword=password
same with https......

Resources