Mod to extend the swproxy with url rewrite functionallity.
npm install swproxy-mod-rewrite``javascript
// register the mod
proxy.registerMod(ModRewrite);
// define a new rewrite rule
proxy.rewriteRule(new RegExp('.*/some/path', ''), '/some/other/path', {});
// change the domain for every request that ends with /some/path
proxy.rewriteRule(new RegExp('.*/(some/path)', ''), 'https://example.com/$1', {});
``
destUrl:
- the request Url will be modified, so the that the destUrl will be used, to make the final request.
modifiers:
- modifiers are an JavaScript Object "{}"
- They can be swproxy specific like 'stopPropagation'. See (doc)[https://github.com/alexanderbartels/swproxy#modifier] for more information.
- ...
MIT © Alexander Bartels
[npm-image]: https://badge.fury.io/js/swproxy-mod-rewrite.svg
[npm-url]: https://npmjs.org/package/swproxy-mod-rewrite
[daviddm-image]: https://david-dm.org/alexanderbartels/swproxy-mod-rewrite.svg?theme=shields.io
[daviddm-url]: https://david-dm.org/alexanderbartels/swproxy-mod-rewrite