Skip to content

Proxying to proxy ... how? #211

@InputOutput

Description

@InputOutput

Expected behavior

I want to have requests between our middleware using Express & http-proxy-middleware to be proxied to another debugging proxy (in this case OWASP ZAP) to be able to easily debug the traffic between middleware and API.

Actual behavior

I am unable to find the correct setup to achieve this. I have activated the toProxy, xvfb and changeOrigin options but have no idea how to actually tell the proxy to proxy via OWASP.

Setup

  • http-proxy-middleware: 0.17.4
  • server: express 4.16.2
  • other relevant modules

proxy middleware configuration

const proxyDefaults = {
    target: `${config.api.root}`,
    toProxy: true,
    xfwb: true,
    logLevel: config.loglevel.proxy,
    changeOrigin: true,
    secure: config.api.secure,
    pathRewrite: {
        '^/express': '/v2'
    },
    logProvider: function() {
        return logger;
    }
};

server mounting

router.all('*', authenticationMiddleware, proxy(Object.assign({}, injectAccessToken, proxyDefaults)));

app.use('/express', router);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions