# swproxy-mod-rewrite

> Mod to extend the swproxy with url rewrite functionallity.

Latest version **0.0.4** (published 2015-12-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install swproxy-mod-rewrite
pnpm add swproxy-mod-rewrite
yarn add swproxy-mod-rewrite
bun add swproxy-mod-rewrite
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2015-12-05 |
| First published | 2015-11-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Alexander Bartels |
| Maintainers | bartels |
| Keywords | swproxy, swproxy-mod, serviceworker, proxy |

## Links

- npm: https://www.npmjs.com/package/swproxy-mod-rewrite
- Repository: https://github.com/alexanderbartels/swproxy-mod-rewrite
- Homepage: http://www.alexanderbartels.com/swproxy-www
- Issues: https://github.com/alexanderbartels/swproxy-mod-rewrite/issues
- npm.io page: https://npm.io/package/swproxy-mod-rewrite

## Alternatives

- [cron](https://npm.io/package/cron.md) — 4.9M weekly downloads
- [@vercel/queue](https://npm.io/package/@vercel/queue.md) — 731.6K weekly downloads
- [create-sonicjs](https://npm.io/package/create-sonicjs.md) — 1.6K weekly downloads
- [@exellix/jobs-api](https://npm.io/package/@exellix/jobs-api.md) — 941 weekly downloads
- [@forwardimpact/libskill](https://npm.io/package/@forwardimpact/libskill.md) — 575 weekly downloads

## Recent versions

- 0.0.4 (latest) — 2015-12-05
- 0.0.0-beta.2 (master) — 2015-11-22
- 0.0.3 — 2015-11-28
- 0.0.2 — 2015-11-28
- 0.0.1 — 2015-11-27
- 0.0.0-beta.1 — 2015-11-22

## README

# swproxy 
[![NPM version][npm-image]][npm-url] [![wercker status](https://app.wercker.com/status/ad827be9e837ad12afdd9c0b63e83bf6/m/master "wercker status")](https://app.wercker.com/project/bykey/ad827be9e837ad12afdd9c0b63e83bf6)
[![Dependency Status][daviddm-image]][daviddm-url]

## work in progress

## How to use the RewriteMod

```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', {});
```

### proxy.rewriteRule(srcUrl, destUrl, modifiers);
srcUrl:
   - the rule will only executed for requests, that matches this regular expression.

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.
  - ...

## License

MIT © [Alexander Bartels](http://www.alexanderbartels.com)

[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

---
_Source: https://npm.io/package/swproxy-mod-rewrite · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
