reverse-proxy.js | Personal reverse proxy server supporting WebSockets | Proxy library
kandi X-RAY | reverse-proxy.js Summary
kandi X-RAY | reverse-proxy.js Summary
Personal reverse proxy server supporting WebSockets, implemented in TypeScript.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of reverse-proxy.js
reverse-proxy.js Key Features
reverse-proxy.js Examples and Code Snippets
Community Discussions
Trending Discussions on reverse-proxy.js
QUESTION
My question is: is http-proxy, reverse-proxy.js, or any other library(with exception of a web-server like nginx) capable of routing all requests that comes to the port 80 to another services based on the url?
If a request comes at the port 80 with that url localhost:80/route1
I want to redirect it to the service at localhost:3001
If a request comes at the port 80 with that url localhost:80/another-route
I want to redirect it to the service at localhost:3002
. And so on..
To summarize it: I want to expose 1 port(80), and then route the request to other services based on the URL pattern from the request. So far I tried this approach below using reverse-proxy.js but it only works if the port changes
...ANSWER
Answered 2020-Sep-08 at 21:16Yes of course you can. It's a very common requirement. In Node you can do it natively using streams. Here's a full working example using only the standard Node http library.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install reverse-proxy.js
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page