https://github.com/drowzy/pico-proxy
https://github.com/drowzy/pico-proxy
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/drowzy/pico-proxy
- Owner: drowzy
- License: mit
- Created: 2015-11-08T19:54:21.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-03-07T08:37:48.000Z (over 10 years ago)
- Last Synced: 2025-04-07T09:17:05.457Z (about 1 year ago)
- Language: JavaScript
- Size: 19.5 KB
- Stars: 3
- Watchers: 3
- Forks: 3
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pico-proxy [![NPM version][npm-image]][npm-url]
> Tiny http proxy for interacting with cross-domain APIs without CORS
## Install
```sh
$ npm install -g pico-proxy
```
## Usage
```js
var picoProxy = require('pico-proxy');
var proxy = picoProxy({ target: 'http://api.domain.com' }).listen(3000);
/* All requests to http://127.0.0.1:3000 will be proxied to http://api.domain.com */
```
## CLI
```
$ pico-proxy --help
Usage
$ pico-proxy
Options
--target hostname or ip to the target server, defaults to http://127.0.0.1
--port port to listen to for the proxy server, defaults to 8080
--protocol protocol used when creating the proxy server, defaults to http
--cors if the proxy server should handle CORS requests, defaults to true
--allow-headers overrides for Access-Control-Allow-Headers, defaluts to '*'
--allow-methods overrides for Access-Control-Allow-Methods, defaults to '*'
--allow-request overrides for Access-Control-Allow-request-Methods, defaults to '*'
Examples
$ pico-proxy --port 3333 --protocol http --target http://api.hostname.com
$ pico-proxy --target http://api.hostname.com --allow-headers "Content-type,X-Sessioncookie"
```
[npm-image]: https://badge.fury.io/js/pico-proxy.svg
[npm-url]: https://npmjs.org/package/pico-proxy