core icon indicating copy to clipboard operation
core copied to clipboard

Feature: request under Node.js can proxy like a browser

Open kitsonk opened this issue 8 years ago • 4 comments

Enhancement

When working with request under Node.js, we should have similar functionality to what is available when running under XHR, in the sense of being able to configure the proxies in a particular way, but also supporting things like PAC configurations.

In order to do this we need to:

  • A proxy detection functionality, including DNS WPAD
  • Ability to read and resolve proxy configuration files (PAC)
  • Ability to assert manual configuration using authentication

kitsonk avatar May 15 '17 08:05 kitsonk

We may want some of this to be a separate package. I started the PAC parser/resolver on Friday and it’s going to add dependencies on fibers (to be able to run dns.lookup synchronously in the PAC script), netmask, and ip.

bryanforbes avatar May 21 '17 23:05 bryanforbes

Blah, yeah, I see the problem. What we have as a very light external run-time dependencies would suddenly become crowded and only be required by a smaller subset of users. I would be 👍 for breaking out as a separate package, with a replacement node request provider and additional modules for doing the proxy detection. I just don't know what we would name it.

kitsonk avatar May 22 '17 09:05 kitsonk

I think most of the code to actually use the proxy settings could still live in @dojo/core, but we could move the PAC and auto detection stuff to a separate package and users would do something like this:

import request from ‘@dojo/core/request’;
import { pac } from ‘@dojo/proxy’;

request(url, { proxy: pac(...) })

bryanforbes avatar May 22 '17 18:05 bryanforbes

Would proxy be the right name, given that it would (at this point) only relate to running under Node.js or Electron? That is also one thing to check with fibres that it would work under Electron.

kitsonk avatar May 23 '17 13:05 kitsonk