Skip to content

fibjs/fib-rproxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

a922710 · Apr 10, 2021

History

27 Commits
Apr 10, 2021
Apr 10, 2021
Aug 11, 2017
Apr 10, 2021
Aug 11, 2017
Aug 30, 2017
Apr 10, 2021

Repository files navigation

General proxy server for fibjs

Install

fibjs --install fib-rproxy

Test

fibjs test

Simple example.

//create proxy server
var rproxy = require("fib-rproxy");

rproxy.server.run({
    // config
    server_timeout: 5 * 1000,
	client_timeout: 5 * 1000,
	domain: ["d3j.io"],
	port: 9988,
	error_domain: `HTTP/1.0 500\n\n unknown domain`,
	error_timeout: `HTTP/1.0 500\n\n server not online`
});
//create proxy client
var http = require("http");

var rproxy = require("fib-rproxy");
var rproxyClient = rproxy.client;

var hdlr = new http.Handler({
    '^/ping': function(v) {
        v.response.write("pong");
    },
    '(.*)': [
        http.fileHandler("./", {}, true),
    ]
})

rproxyClient.run({
    url: "tcp://127.0.0.1:9988",
    version: "0.1",
    password: "123456",
    handlers: {
        "proxy": hdlr,
    }
});

About

General proxy server for fibjs.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published