Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Luna-devv committed Sep 1, 2022
1 parent 5d6d954 commit 16c63fd
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,23 @@ Example object for proxing a webserver:
}
```
### key ("proxy.local")
This will be the subdomain or the domain that will be managed.
This value can only be a [String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String), this key is required. <br />
This will be the subdomain (`subdomain.proxy.local`) or the domain (`proxy.local`) that will be managed.

### target
This value can only be a [String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String), this key is required.
This value can only be a [String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String), this key is required. <br />
- (using `"WEB"` or `"WS"`): This is the port on which your webserver runs. Please note that this musst run on the same server as this proxy script.
- (using `"REDIRECT"`): This is the domain/IP the proxy script will redirect to. Note that this can be any domain, it must include the protocal (i.e. `"https://lunish.nl/luna"`)

### type
This value can only be `WEB`, `WS` or `REDIRECT`, this key is required.
This value can only be `WEB`, `WS` or `REDIRECT`, this key is required. <br />
There are 3 essential types:
- `"WEB"`: You will use this if you want that for example the content of the page `123.456.789:4000` should be displayed on `api.waya.one`.
- `"WS"`: You will use this if you have a (server) websocket and you want i.e. to forward it from `123.456.789:4000` to `api.waya.one`.
- `"REDIRECT"`: YOu will use this if you want to redirect the user to another page, this requires setting `target` to a string.

## Additional entries
If you want to do more complex stuff with the proxy, you can do that too.
If you want to do more complex stuff with the proxy, you can do that too. <br />
Here is an example object with *all* possible configurations:
```ts
"proxy.local": {
Expand All @@ -58,35 +59,35 @@ Here is an example object with *all* possible configurations:
```

### arc
This value can only be `true` or `false`, this key is optional.
This value can only be `true` or `false`, this key is optional. <br />
If your site is using [arc.io](https://arc.io/) you can just set this value to `true` to enable support for it. <br />
Note: All requests to `/arc-sw.js` will be catched by the proxy and will **NOT** reach your webserver.

### ip
This value can only be a [String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String), this key is optional.
This value can only be a [String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String), this key is optional. <br />
By default, this script will proxy using the local [`127.0.0.1`](https://www.google.co.jp/search?q=127.0.0.1) IP. If you use docker or generally want to proxy domains for different servers, you can simply change this value to any other IP address.

### overwrites
This value can only be a [Overwrites Array](#overwrites.path), this key is optional.
This value can only be a [Overwrites Array](#overwrites.path), this key is optional. <br />
Overwrites are made to redirect or proxy only specific parts (routes) of the domain and not the whole domain at once.

### overwrites.path
This value can only be a [String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) or a [String Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array#create_an_array), this key is required inside of [`overwrites`](#overwrites).
This will represent the path(s) that will be overwritten. It can be either one (a String) or multiple (an Array) like in the example object above.
This value can only be a [String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) or a [String Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array#create_an_array), this key is required inside of [`overwrites`](#overwrites). <br />
This will represent the path(s) that will be overwritten. It can be either one (a String) or multiple (an Array) like in the example object above. <br />
Note: All requests to this/these path(s) will be catched by the proxy and will **NOT** reach your webserver.

### overwrites.target
This value can only be a [String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String), this key is required inside of [`overwrites`](#overwrites).
This value can only be a [String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String), this key is required inside of [`overwrites`](#overwrites). <br />
For more reference please go to [#type](#target).

### overwrites.type
This value can only be `WEB` or `REDIRECT`, this key is required inside of [`overwrites`](#overwrites).
For more reference please go to [#type](#type).
This value can only be `WEB` or `REDIRECT`, this key is required inside of [`overwrites`](#overwrites). <br />
For more reference please go to [#type](#type). <br />
Note: `WS` (websockets) aren't supported as overwrite.

## Modify error pages
If you want to to change the error pages for either a missing record ([`404.html`](https://github.com/Luna-devv/proxy/blob/main/html/404.html)) or the page for a not responding webserver ([`500.html`](https://github.com/Luna-devv/proxy/blob/main/html/500.html)), go to the [`/html/`](https://github.com/Luna-devv/proxy/tree/main/html) file tree and start editing your plain HTML pages there. <br />
Note: There is a `{hosts}` placeholder that will be replaced with the requested domain (i.e.: `api.waya.one`)
Note: There is a `{hosts}` placeholder that will be replaced with the requested domain (i.e.: `proxy.local`)

## Any questions left?
Feel free to open a issue, send me an [E-Mail](mailto:[email protected]) or [join](https://lunish.nl/support) my Discord server.

0 comments on commit 16c63fd

Please sign in to comment.