I am trying to get scoped npm packages to work with Artifactory behind Apache. I can publish a scoped package to Artifactory and it creates the following path in the npm-local repo: #scopename/packagename/-/#scopename/packagename-version.tgz
My problems arise trying to install this package. I get a 404 Not Found: #scopename/packagename. Looking at the debug log I can see that maybe it has something to do with the encoding of the slashes:
22 http request GET https://artifacts.company.com/artifactory/api/npm/npm-local/#scopename%2fpackagename
23 http 404 https://artifacts.company.com/artifactory/api/npm/npm-local/#scopename%2fpackagename
I have followed the online documentation. I added AllowEncodedSlashes NoDecode to the virtual host and org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true to the catalina.properties file on tomcat.
Am I missing something?
This looks like a reverse proxy issue. Check your request.log. If the request is coming is as /api/npm/npm-group/#angular/core instead of /api/npm/npm-group/#angular%2Fcore, that is something that need to addressed in your reverse proxy.
You have to change two things:
Implement the setting org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH = true
Remove of the context root from the proxy_pass variable in /etc/nginx/conf.d/default.conf
Related
I do as toran proxy document step by step, but i occur a problem
I have configure toran_host and toran_prot in parameters.yml, but generated package josn remain using the the domain
example.org
Package.json
I try to find issue source, but the application is too complex for me.
this is my parameters.yml:
parameters:
# this secret should be changed to something unique and random if possible
secret: ThisTokenIsNotSoSecret-Change-It
# http or https depending on your hosting setup
toran_scheme: http
# in case you use non-standard ports you can update them here
toran_http_port: 91
toran_https_port: 443
# the hostname toran is hosted at
toran_host: 121.199.35.34:91
# e.g. /foo if toran is hosted in a sub-directory, or leave it empty if it is on its own domain, no trailing slash!
toran_base_url:
but have you tried clearing the cache? Delete
everything in ·app/cache/· and try again, because the parameters need to
be set correctly before the cache is created otherwise it is not rebuilt.
this answer come from Jordi's email to me, he is a author of toran, thank for nice and hard work .
You have to modify your config file at app/config/parameters.yml:
# the hostname toran is hosted at
toran_host: example.org
Then delete the production cache at app/cache/prod, and finally run the cron job again php bin/cron -v
For further instructions follow official installation documentation here: https://toranproxy.com/download
When I try to npm publish to a private npm repository on Artifactory I get a Failed PUT 302 error. I followed the directions in their video(https://www.youtube.com/watch?v=gyQ0riy3Hk8) and set up a remote repository that points to registry.npmjs.org, another that is the private repo(npm-local), and a virtual repo that aggregates the remote and private repos.
I set up my ~/.npmrc file to use the Artifactory virtual repo and added my credentials. I am able to install public packages fine using this setup. But when I try to publish directly to /npm-local I always get Failed PUT 302 - the repository responds with a generic nginx 302 Found page and npm can't parse the html.
Currently I am using npm#2.13.3 but I even tried reverting back to 1.4.x after reading npm publish to Artifactory not working and had the same issue.
Also I have tried publishing a directory with package.json in it and a tarball - both produce the same 302 error.
After several emails and a phone call I found the fix:
login to artifactoryonline
Goto Admin Tab
Under general settings set the Custom URL Base to: https://YOUR_ACCOUNT_NAME.artifactoryonline.com/YOUR_ACCOUNT_NAME
They said that they are working on having this set for you by default but until then you have to set it manually. Unfortunately it is not documented anywhere and not mentioned in any of the videos that I saw.
NPM v6 is not able to handle the HTTP Status 302. It process this code as successful printing PUT 302 into verbose output. It happens for example, if the Artifactory server expects the connection over https and redirects all the requests from port 80 to 443. NPM v8 handles redirects correctly.
My Linux(redhat6) server has to use http proxy to connect to outside world. While it works for other things like wget, it doesn't work for cabal.
cabal update -v3
shows errors like this:
407 - proxy authentication required cabal: Failed to download
http://hackage.haskell.org/packages/archive/00-index.tar.gz :
ErrorMisc "Unsucessful HTTP code: 407"
I tried to change http_proxy environment variable to format like http:// user: passwd at proxy:port, but it doesn't work either.
The same problem has been asked here
But I'm not allowed use a proxy server like polipo, is there any other way to make cabal work behind a proxy?
You can use cntlm to talk to proxy. It will handle authentication issues. After configuring and installing cntlm, set up the new environmental variable by modifying http_proxy, https_proxy etc.
Your cabal command should work after that.
some detailed procedure here:
Download cntlm from here
It's a c program with no other dependencies so very easy to make, just follow the instructions in the downloaded package.
After installing cntlm, follow this answer from Colonel Panic. Obviously on linux you need to change cntlm.exe to ./cntlm, I named the configure file cntlm.conf
The default listen port for cntlm is 3124, if you can't use that port, change it to something else like 53124, then add this to your cntlm.conf or cntlm.ini file:
Listen 127.0.0.1:53124
Start cntlm in the background:
./cntlm -c cntlm.conf
Change your http_proxy environment variable to talk to the cntlm process rather than the real proxy.
export http_proxy=http:// 127.0.0.1:53124
That's it, cabal will work as good as ever.
You can also setup the http_proxy directly in the system setting:
http_proxy=http://username:password#hostname:port
I am trying to install bower
npm install -g bower
but am getting an authentication error from our proxy
...
npm http 407 http://registry.npmjs.org/bower
...
Error Code: 407 Proxy Authentication Required.
...
I am trying to get npm working behind a corprate proxy. I think our proxy is a little weird because the only way I was able to get maven downloading packages was to add wagon-http-lightweight.jar as a maven extension.
http://maven.apache.org/wagon/wagon-providers/wagon-http-lightweight/
I have tried all the regular things as described here:
Is there a way to make npm install (the command) to work behind proxy?
(I don't need to supply authentication details in my maven proxy settings).
npm config set registry http://registry.npmjs.org/
npm config set proxy http://myusername:mypassword#proxy.us.somecompany:8080
npm config set https-proxy http://myusername:mypassword#proxy.us.somecompany:8080
npm config set strict-ssl false
What else can I try?
Can try this....working for me.
Open IE (Chrome did not work for me).
Hit the URL http://registry.npmjs.org
it will download json output if successful.
Now go back to command prompt and try npm install.
I was able to get this working by installing a local proxy:
NPM behind NTLM proxy
Use fiddler http://www.telerik.com/fiddler
Install and run and that's it, everything will run as it is supposed to. I spent half a day cracking my head on this
Edit: I honestly have no idea if it was fiddler or something else I tried that fixed it (it is mostly the latter) but you should try setting registry, http-proxy, proxy and strict-ssl
When authentication is required for the HTTP proxy:
Fiddler can be configured to authenticate with the corporate HTTP proxy using NTLM or other protocols. Leave the existing auto authenticate options/rules defaults in place. Instead, go to this setting from the menu bar:
Tools > Telerik Fiddler Options > Connections tab
Click on the Allow remote computers to connect checkbox. You will see a dialog explaining the consequences of enabling this option. Restart Fiddler and update the .npmrc file as shown above. Whenever you need npm to access the registry site just run Fiddler. This setting won't affect the way Fiddler runs for other captures.
I have the same issue.
The root cause is my password contains a special character '#', when I npm set config proxy, the character become '#' in .npmrc file, so I change my password to remove the special character and it's working fine.
If your password does not contains special characters, just use syntax command below, it will work.
npm config set strict-ssl=false
npm config set proxy http://<username>:<password>#<proxy-server-url>:<port>
npm config set https-proxy http://<username>:<password>#<proxy-server-url>:<port>
Thanks,
I'm trying to access the npm repository from an intranet using a proxy.
Using the proxy (set in the environment variables HTTP_Proxy and HTTPS_Proxy) I'm able to access the repository without ssl using my browser, and using wget:
wget registry.npmjs.org/yuidocjs
When I use https, I can access with my browser, but not with wget
wget https://registry.npm.js.org/yuidocjs #fails
When I try to use NPM, setting registry=http://registry.npm.js.org/ results in a 404.
When I use the default https registry path, it results in a timeout.
Anything I'm missing here? My config file looks like this:
proxy = http://ems-lnx222:8080/proxy.pac
https-proxy = http://ems-lnx222:8080/proxy.pac
registry = http://registry.npmjs.org/
prefix = /ws/bemccorm-rtp/npm-packages
strict-ssl = false
Update
After some more playing I figured out that the .pac proxies seemed to be causing a problem.
I used a normal proxy instead, and now get a 200 status, GET the correct tgz file, and then receive an npm ERR! fetch failed when trying to fetch the file.
I am sure it was a typo but just to make it more clear for debugging.
When I use https, I can access with my browser, but not with wget
wget https://registry.npm.js.org/yuidocjs #fails
The domain was wrong... npm.JS instead of npmjs...
Going further with wget
wget https://registry.npmjs.org/yuidocjs
--2013-07-09 15:57:25-- https://registry.npmjs.org/yuidocjs
Resolving registry.npmjs.org (registry.npmjs.org)... 67.228.31.146
Connecting to registry.npmjs.org (registry.npmjs.org)|67.228.31.146|:443... connected.
ERROR: cannot verify registry.npmjs.org’s certificate, issued by “/C=US/ST=CA/L=Oakland/O=npm/OU=npm Certificate Authority/CN=npmCA/emailAddress=i#izs.me”:
Unable to locally verify the issuer’s authority.
To connect to registry.npmjs.org insecurely, use ‘--no-check-certificate’.
If you use --no-check-certificate it works and download.
But we know this is not your MAIN problem your Main problem is the .PAC files.
I worked as a sysadmin and several times we have to write different rules at .pac files as:
1) If it is internal send everything to this router
2) If connected by vpn network do this
3) etc
So Please do a get and transcribe the .pac files so we can see the rules.
The .pac files is nothing more than javascript.
Regards
Repocache worked for this.
npm config set registry https://127.0.0.1:5000/npm/default/
npm install color
Startup repocache with setting below:
[npm.upstream.default]
url = https://registry.npmjs.org
If proxy is need, add proxy like:
http = http://127.0.0.1:1087
https = socks5://127.0.0.1:1086