dropbox-sdk-js icon indicating copy to clipboard operation
dropbox-sdk-js copied to clipboard

support proxy settings

Open gildas opened this issue 8 years ago • 13 comments

Since you guys use superagent for your http requests, why not adding proxy support?

I have customers that allow outbound traffic only through their proxy. Which means, they cannot use Dropbox with my code at the moment.

Basically, just use superagent-proxy like this:

var request = require('superagent');

require('superagent-proxy')(request);

downloadRequest = function (path, args, auth, host, accessToken, selectUser, proxy) {
  . . .
  apiRequest = request.post(getBaseURL(host) + path) . . .;

  if (proxy) apiRequest.proxy(options.proxy);
  . . .

The proxy parameter should be configured in the Dropbox constructor.

Thoughts?

gildas avatar Aug 21 '17 07:08 gildas

Thanks for writing this up! I can't make any promises, but I'll send this feature request along to the team.

greg-db avatar Aug 21 '17 17:08 greg-db

Thanks @greg-db If you want I am happy to work on a PR.

gildas avatar Aug 21 '17 21:08 gildas

We always appreciate pull requests! Thanks!

greg-db avatar Aug 21 '17 21:08 greg-db

Ok, I'll see what I can do within the next few days.

gildas avatar Aug 21 '17 21:08 gildas

Here you go @greg-db, PR #151.

gildas avatar Aug 22 '17 15:08 gildas

Thanks Gildas!

greg-db avatar Aug 22 '17 15:08 greg-db

No problem. Though, it seems like the travis ci job keeps failing.

> eslint src --ignore-path src/types.js
/home/travis/build/dropbox/dropbox-sdk-js/node_modules/superagent-proxy/node_modules/proxy-agent/node_modules/pac-proxy-agent/node_modules/socks-proxy-agent/node_modules/agent-base/index.js:8
const inherits = require('util').inherits;
^^^^^
SyntaxError: Use of const in strict mode.

I am afraid the eslint config is too strict for the external superagent-proxy module.

gildas avatar Aug 22 '17 15:08 gildas

Thanks, we'll take a look.

greg-db avatar Aug 22 '17 15:08 greg-db

thanks a lot!

gildas avatar Aug 22 '17 15:08 gildas

I should be around for an hour more or so (I am in Japan, so it is late here)

gildas avatar Aug 22 '17 15:08 gildas

Hey @gildas we should be able to close this when I make a new release in a few hours. Let me know if you disagree.

pran1990 avatar Sep 15 '17 06:09 pran1990

I would be interested in this feature. Just not sure what about the PR broke things.

kevindice avatar Apr 30 '18 21:04 kevindice

@kevindice a possible reason is that we moved form using superagent to fetch. Can you try https://www.npmjs.com/package/fetch-with-proxy and let me know if that works for your usecase? If so, I'll add a section about proxies in the docs.

pran1990 avatar Apr 30 '18 23:04 pran1990