Skip to content

1.1.* introduces a bug in pathRewrite option #45

Description

@ctrlaltdylan

Hi,

I was using the old signature for pathRewrite of a plan object, with the key as the test pattern & the value being the replacement string.

This was working great with v1.0.* of the library, but it seems like the new v1.1.* introduce change broke this compatiblity.

httpProxyMiddleware(req, res, {
    target: `https://${shop.name}/admin/api/2021-10/graphql.json`,
    headers: {
      "Content-Type": "application/json",
      "X-Shopify-Access-Token": shop.accessToken,
    },
    changeOrigin: true,
    ws: true,
    pathRewrite: {
      "^/api/graphql": "",
    },
  });

I attempted to use the new Array based syntax:

    pathRewrite: [{
      patternStr: "^/api/graphql",
      replaceStr: ""
    }],
  });

But the without being able to visualize the request, I'm not sure why that request is being rejected by the host.

I just know that downgrading and keeping the old signature works for my case.

Leaving this for documentation purposes, maybe I'll get around to adding a debugging mode or something to view the request's parameters easier.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions