The situation:

  • Node Express.js app connects to SharePoint via pnp.js (REST)
  • this app MUST route through a proxy


  • How can I force the node express.js app to use the proxy ?

In powershell:

So I think I need the equivalent of the -Proxy parameter in my Express.js app.

Thanks for any pointers.


The documentation of PnPJS shows how to set a proxy URL when performing the setup: https://pnp.github.io/pnpjs/nodejs/docs/proxy/

import { SPFetchClient, SPOAuthEnv, setProxyUrl } from "@pnp/nodejs";

    sp: {
        fetchClientFactory: () => {

            // call the set proxy url function and it will be used for all requests regardless of client
            setProxyUrl("{your proxy url}");
            return new SPFetchClient(settings.testing.sp.url, settings.testing.sp.id, settings.testing.sp.secret, SPOAuthEnv.SPO);
  • sorry for the late reply, been busy I don't have an id, nor a secret. The nodejs app is not a addin. I'm logging in on SharePoint onpremise with adfs credentials. It works, using pnp-auth, for situations where no corp proxy is in-between. I cannot get it to work with the proxy though
    – user901926
    Oct 28 '19 at 15:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.