2

My organization does not allow servers with direct access to internet. We have Nexus 3 OSS installed in the offline machine with proxy access to https://registry.npmjs.org enabled. I have tested the flow from our nexus machine to https://registry.npmjs.org and it works fine. Next we have set up npm-proxy repository as here

To access nexus server we have to go through reverse proxy server - which is Apache server(version 2.4) with virtual host redirect to the nexus machine. We have registered a dns alias for the reverse proxy server and redirected to nexus installed service port. We did refer this

Now from my nexus installed machine terminal i placed a very basic package.json and also updated the npm registery to point to our nexus. Next I test the setup with npm install. It works fine. I get node_modules created. However nothing is updated when i browse the repository in nexus.

Any hints on what can be missing or how to troubleshoot will greatly help.

What I tried:

When i set the npm registry to https://registry.npmjs.org with proxy set in .npmrc file i get the node_modules created.

When i change the registry back to point to my company nexus with proxy still active, i get error : npm ERR! code E502 npm ERR! 502 Bad Gateway - GET https://repos-dev.company.hub/repository/npm-proxy/@angular%2fcdk .

When i delete the proxy (which should be the case as i can reach my company nexus without proxy) i get error: npm ERR! request to https://repos-dev.company.hub/repository/npm-proxy/@angular%2fcdk failed, reason: write EPROTO 140244137531200:error:1425F102:SSL routines:ssl_choose_client_version:unsupported protocol:../deps/openssl/openssl/ssl/statem/statem_lib.c:1922:

I am not sure where I am going wrong.

Some more inputs that may help understand my setup:

A bit on company nexus setup: Nexus is installed in an offline server. This server is where I am trying all of the above. From this server we have proxy access to https://registry.npmjs.org enabled. We have tested the npm install by directly using this registry with proxy server details and it works fine.

The nexus server can be accessed from user network(browser) using apache reverse proxy. Apache server(version 2.4) is installed on other offline windows server (does not have internet access enabled, however proxy access to https://registry.npmjs.org is enabled). From this server we use virtual host redirect to nexus server.

Below is the rule: ServerName repos-dev.company.hub ProxyPreserveHost On SSLEngine on

SSLProxyEngine on

    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

    ProxyRequests Off
    ProxyPreserveHost On
    RewriteEngine On
    RequestHeader set X-Forwarded-Proto "https"
    AllowEncodedSlashes NoDecode

SSLCertificateFile "D:\certs\repos-dev_company_hub.pem"
SSLCertificateKeyFile "D:\certs\repos-dev.company.hub.key" 
SSLProtocol All -SSLv2 -SSLv3 -TLSv1 -TLSv1
SSLHonorCipherOrder On
LogLevel debug
ProxyPass / http://<nexus server ip:port>/ nocanon
ProxyPassReverse / <nexus server ip:port>/


ErrorLog "logs/repos-error.log"
CustomLog "logs/repos-access.log" common

AllowEncodedSlashes NoDecode

I have checked the access to https://registry.npmjs.org from my apache server (windows machine) from the browser (need to enable proxy) and it is reachable.

In nexus configurations i have configured my npm-proxy to use https://registry.npmjs.org as the registry. I have also enabled the HTTP proxy from the nexus dashboard.

Below is the detailed logs

65 verbose stack FetchError: request to https://repos-dev.company.hub/repository/npm-proxy/@angular%2fcompiler failed, reason: write EPROTO 140311458678592:error:1425F102:SSL routines:ssl_choose_client_version:unsupported protocol:../deps/openssl/openssl/ssl/statem/statem_lib.c:1922:
65 verbose stack
65 verbose stack     at ClientRequest.<anonymous> (/opt/node/lib/node_modules/npm/node_modules/node-fetch-npm/src/index.js:68:14)
65 verbose stack     at ClientRequest.emit (events.js:200:13)
65 verbose stack     at TLSSocket.socketErrorListener (_http_client.js:402:9)
65 verbose stack     at TLSSocket.emit (events.js:200:13)
65 verbose stack     at errorOrDestroy (internal/streams/destroy.js:107:12)
65 verbose stack     at onwriteError (_stream_writable.js:438:5)
65 verbose stack     at onwrite (_stream_writable.js:459:5)
65 verbose stack     at internal/streams/destroy.js:49:7
65 verbose stack     at TLSSocket.Socket._destroy (net.js:593:3)
65 verbose stack     at TLSSocket.destroy (internal/streams/destroy.js:37:8)
65 verbose stack     at WriteWrap.onWriteComplete [as oncomplete] (internal/stream_base_commons.js:84:12)
66 verbose cwd /data/npmTest
67 verbose Linux 3.10.0-693.21.1.el7.x86_64
68 verbose argv "/opt/node/bin/node" "/opt/node/bin/npm" "install"
69 verbose node v12.4.0
70 verbose npm  v6.9.0
71 error code EPROTO
72 error errno EPROTO
73 error request to https://repos-dev.company.hub/repository/npm-proxy/@angular%2fcompiler failed, reason: write EPROTO 140311458678592:error:1425F102:SSL routines:ssl_choose_client_version:unsupported protocol:../deps/openssl/openssl/ssl/statem/statem_lib.c:1922:
74 verbose exit [ 1, true ]

Any help is highly appreciated.

nishat
  • 947
  • 2
  • 8
  • 15
  • Can you include your npm install, perhaps on debug? Also you can check the request.log and make sure everything you downloaded is 200. – joedragons Jul 09 '19 at 23:40
  • 1
    I edited my question with more info. I could figure put why the nexus was not getting updated with the jars despite it working in the terminal. I had first tested with direct access to https://registry.npmjs.org which generated node_modules and package-lock.json. Now when I changed the registry to my company nexus i still got node_modules due to package-lock.json. After i deleted this file I started getting error as mentioned above. – nishat Jul 24 '19 at 10:28
  • Can you try a non-scoped package just to verify it's not balking at the encoding? Your config does look right to my novice eyes but might be a good check. Also if possible worth by passing apache to make sure it's not that. – joedragons Jul 24 '19 at 21:26
  • did you get any solution? – Anand Varkey Philips Aug 13 '20 at 20:03

0 Answers0