lokalise / node-lokalise-api

Lokalise API v2 Node.js client.

Home Page:https://lokalise.github.io/node-lokalise-api

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support corporate proxy

michalzubkowicz opened this issue · comments

Currently behind corporate firewall it is not possible to use any lokalise client, especially the this one in node. I've checked source code and tested proof of concept implementation and it is quite easy to implement. You are using 'got' http client which support proxies https://github.com/sindresorhus/got/blob/main/documentation/tips.md#proxying
You only need to extend configuration of of node-lokalise-api and pass proxy settings there.

Can you put such feature on roadmap?

Good day. Yeah, this feature was already discussed here #72 I'm somewhat hesitatant to use tunnel but perhaps we could try hpagent? Altetnatively, you could go with https://github.com/gajus/global-agent which won't require any code changes from our side. @beinarovic thoughts?

With hpagent, we could allow to pass an agent option to the client in the following manner:

const agent = new HttpProxyAgent({
  keepAlive: true,
  keepAliveMsecs: 1000,
  maxSockets: 256,
  maxFreeSockets: 256,
  proxy: 'http://user:pwd@localhost:8080'
})

global-agent works for me so it's probably best solution for both sides. Please update the docs with it, it will save someone's day.

Okay, I'm glad we were able to find a solution so fast :) I'll update the docs now!