You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
2.9 KiB

![Logo](admin/proxy.png)
# yunkong2.proxy
=================
[![NPM version](http://img.shields.io/npm/v/yunkong2.proxy.svg)](https://www.npmjs.com/package/yunkong2.proxy)
[![Downloads](https://img.shields.io/npm/dm/yunkong2.proxy.svg)](https://www.npmjs.com/package/yunkong2.proxy)
[![Tests](https://travis-ci.org/yunkong2/yunkong2.proxy.svg?branch=master)](https://travis-ci.org/yunkong2/yunkong2.proxy)
[![NPM](https://nodei.co/npm/yunkong2.proxy.png?downloads=true)](https://nodei.co/npm/yunkong2.proxy/)
## Usage
Allows to access defined URLs or local files via one web server.
Specified routes will be available under ```http://ip:8082/proxy.0/context/...```. Of course port, protocol, "proxy.0", can variate depends on settings.
## Configuration
- Extend WEB adapter: For which web instance will active this proxy.
- Route path: Path for proxy. If "/proxy.0", so the routes will be available under ```http://webIP:8082/proxy.0/...```
- Error timeout(ms): Minimal interval between retries if the requested resource was unavailable or returned error.
## Sample settings
| Context | URL | Description |
|----------------|:---------------------------------------------------|:---------------------------------------------------|
| admin/ | http://localhost:8081 | access to admin page |
| router/ | http://192.168.1.1 | access to local router |
| cam/ | http://user:pass@192.168.1.123 | access to webcam (e.g. call http://ip:8082/proxy.0/cam/web/snapshot.jpg) |
| dir/ | /tmp/ | access to local directory "/tmp/" |
| dir/ | tmp/ | access to local directory "/opt/yunkong2/tmp" |
| file.jpg | /tmp/picture.jpg | access to local file "/tmp/picture.jpg" |
**Not all devices can be accessed via proxy.
Some devices wants to be located in the root ```http://ip/``` and cannot run under ```http://ip/proxy.0/context/```.
You can read more about context [here](https://www.npmjs.com/package/http-proxy-middleware#context-matching)
Additionally the user can define the route path for proxy requests.
## Changelog
### 1.0.3 (2018-07-14)
* (bluefox) Newer mime version used
### 1.0.2 (2018-06-30)
* (bluefox) URI was decoded for usage of special chars in password and login
### 1.0.1 (2018-03-01)
* (bluefox) Fixed error: after 10 timeouts the web cam was never reachable
* (bluefox) Ready for Admin3
### 1.0.0 (2017-10-09)
* (bluefox) do not allow the error generation to fast
### 0.2.0 (2017-03-13)
* (bluefox) fix run-mode
### 0.0.1 (2017-01-09)
* (bluefox) initial commit