Using Node.js to redirect and proxy normal HTTP+WebSocket traffics based on hostnames

Usually I used to use a single server to host several developing or experimental projects. Thus I need a quick solution to forward different request to these services. I had tried to use nginx before. But now I have a easier way to do so.

  1. require modules

  2. config proxy(forward) and redirect mappings (hostname based)

    var proxyOptions = {
    router: {
    "" : 'localhost:2041',
    "" : 'localhost:2042',
    "" : 'localhost:10520',
    "" : 'localhost:10520',
    '' : 'localhost:8888'
    redirectOptions = {
    '' : '',
    '' : '',
    '' : ''

Display remote Node.JS service logs on Chrome Console

In recent years, we got plenty of PaaS services which provide very simple and easy way to deploy our Node.JS services.

Usually after deploying my service, I have to use the command line tools or visit some very slow web pages to access the server logs. It’s really waste my time.

But today, I want to introduce a tool, Chrome Logger, it provides a way to display server logs into Chrome Developer Tool’s Console.

Install it, then visit my sample project on Heroku to see what’s going on.

  • Sample Test Project on Github

Update 06/25 00:40:

  • If you’re using ExpressJS, you can simple log your error like following error handling middleware

Update 06/25 01:50:

Pull requests sent : chromelogger & express-chrome-logger.

Good luck to myself.

Simple one-step web(http) Server

We all know Mac OS has a powerful sharing feature called AirDrop, but it too simple to share to multiple users. Sometimes we really need a simple web server for sharing our static resource, For instance,  HTML file, simple folder,  or some multimedia files.
 We can use Python on Ubuntu…


Usage : 

python -m SimpleHTTPServer [port]

And I have to work under Micro$oft Windows sometimes…


Install : 

  • Download the F5 application

Usage : 

  • Simply drag your folder or file into the application, it will shows the browsable URL.

But i prefer nodejs based…


Simple http server

Install : 

npm install simple-http-server -g

Usage :