2

I need to use cumulocity behind the proxy server. Therefore, I have set the proxy addresses using: "npm set proxy" and "npm set https-proxy". Now I am able to run a standard angular project and it works fine.

But when I create a c8y project and run it using "c8ycli server -u ...", I get this error by each request:

[HPM] Error occurred while trying to proxy request /tenant/loginOptions from localhost:9000 to https://....com (ECONNREFUSED) (https://nodejs.org/api/errors.html#errors_common_system_errors)

Does c8ycli use npm proxy settings? How can I set proxy address for c8ycli?

Parda
  • 31
  • 5

1 Answers1

1

I think it has nothing to do with c8y itself. You should try setting the proxy manually with npm:

npm config set proxy http://proxy.company.com:8080
npm config set https-proxy http://proxy.company.com:8080

Taken from here

Hope this help!

Edit:

Checking at the c8y tool (/usr/local/lib/node_modules/cumulocity-tools in my case) I notice they are using express (lib/devserver/server.js) when you run the server command. In that file they use their own proxy (lib/devserver/proxy.js) settings to resolve the localhost to the tenant's url.

As they are using express I think you can change those file to set you proxy configurations. I have not much experience with express but I found some information searching

express behind-proxies

nodejs-express-why-should-i-use-app-enabletrust-proxy

using-app-set-to-set-trust-proxy

Good luck!

Jorge
  • 238
  • 1
  • 10
  • As I wrote, I had set the configs and it works fine with standard angular commands. But c8ycli doesn't take these proxy settings and I cannot run c8y projects! – Parda Oct 11 '19 at 10:59
  • Your edit addresses the issue, but how can we adjust the proxy settings for c8y? It would be ideal if someone from from c8y team suggest a tested solution. – Parda Oct 22 '19 at 10:38