![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
dynamic-reverse-proxy
Advanced tools
A reverse proxy built on [http-proxy](https://github.com/nodejitsu/node-http-proxy) that is configured by REST.
A reverse proxy built on http-proxy that is configured by REST.
var http = require("http"),
server = http.createServer(),
dynamicProxy = require("dynamic-reverse-proxy")();
server.on("request", function (req, res) {
if (req.url.match(/^\/register/i)) {
proxy.registerRouteRequest(req, res);
}
else {
proxy.proxyRequest(req, res);
}
});
server.listen(3000, function () {
console.log("Reverse Proxy started, listening on port 3000");
});
The reverse proxy is configured to route based on the first segment of the path. For example:
/
would route to the host registered at /
/application1
would route to the host registered at /application1
/application2/test/index.html
would route to the host registered at /application2
To register the a host with the proxy:
POST /register HTTP/1.1
Host: localhost:3000
Content-Length: 28
Content-Type: application/json
{"prefix": "/", "port":1234}
Now, any request made to http://localhost:3000/
will be sent to http://localhost:1234/
.
To register another host:
POST /register HTTP/1.1
Host: localhost:3000
Content-Length: 32
Content-Type: application/json
{"prefix": "/test", "port":4321}
Now, any request made to http://localhost:3000/test
will be sent to http://localhost:4321/test
.
Well, it's pretty lame (but functional) at the moment. Only requests originating from the same machine as the proxy are allowed to register.
The dynamic proxy object that is returned is an EventEmitter with the following events:
proxyError
is passed (error, host, request, response)
and is emitted when:
500 Internal Server Error
will be returned.error
will be NOT_FOUND
. If no handler ends the response back to the original client, 501 Not Implemented
will be returned.registerError
is passed (error, request, response)
and is emitted when a request is sent to /register
but it could not be handled correctly. Error will be one of the following:
FORBIDDEN
(not allowed)METHOD_NOT_ALLOWED
(must be a POST)BAD_REQUEST
(not parsable as JSON)INCOMPLETE_REQUEST
(path and port were not supplied)routeRegistered
is passed (host)
and is emitted when a request is sent to /register
and it was successful.
dynamicProxy.addRoutes(routes)
adds an object of routes in the following format:{
"/": {
"prefix": "",
"port": 1234
},
"/test": {
"prefix": "test",
"port": 4321
}
}
FAQs
A reverse proxy built on [http-proxy](https://github.com/nodejitsu/node-http-proxy) that is configured by REST.
The npm package dynamic-reverse-proxy receives a total of 0 weekly downloads. As such, dynamic-reverse-proxy popularity was classified as not popular.
We found that dynamic-reverse-proxy demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.