Skip to content

Luna-devv/proxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

P R O X Y

Basic proxy script written in node.js using node:http and node-http-proxy.
This script was originally written from @flamexdev and was improved and re-written into TypeScript by me.
A full walk trough can be found on this GitHub's Wiki.

Setup

  1. Clone this repository using git clone https://github.com/Luna-devv/proxy
  2. Adapt the src/hosts.ts to your needs and webservers
  3. Install all external dependencies using npm install or yarn install
  4. Compile the code using npx tsc
  5. Run the script with PM2 pm2 start dist/app.js --name proxy

Modify records

Example object for proxing a webserver:

{
    "proxy.local": {
        target: 3000,
        type: "WEB"
    }
}

key ("proxy.local")

This value can only be a String, this key is required.
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, this key is required.

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

Anything else

Please read the wiki at https://github.com/Luna-devv/proxy/wiki

Any questions left?

Feel free to open a issue, send me an E-Mail or join my Discord server.