0.3.2 • Published 7 years ago

freego v0.3.2

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

FreeGo

FreeGo is a node.js http proxy for redirecting requests to different targeted servers via cookies, especially suitable for mobile hosts quick switching.

Benefits

  • Switch environment between testing server and other servers quickly.
  • Inject eruda to html page for mobile client side debugging.
  • Save whole http request for html and json response.

Installation

npm install freego --save

Usage

var freego = require('freego');

freego({
    // Configurations
    proxy: {
        freeGo: {
            pattern: /http:\/\/freego.com\//,
            target: [
                {
                    name: 'Testing',
                    ip: '127.0.0.1',
                    port: '80'
                }
                // List of servers
            ]
        }
    }
});

You need to do a little server configuration staff before using FreeGo. If you're using nginx, add rules to make sure it send requests to FreeGo if url or cookie contains "free_go_proxy". It might look like something below:

location / {
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_pass http://$myserver;
}

location /free_go_proxy {
    proxy_set_header Host $host;
    ...
    proxy_pass http://freegoproxy;
}

map $COOKIE_free_go_proxy $myserver {
    ~* freegoproxy;
    default myserver;
}

upstream freegoproxy {
    # FreeGo server
    server 127.0.0.1:13191;
}

upstream myserver {
    server 127.0.0.1:13192;
}

After that, navigate http://xxx/free_go_proxy to enable freeGo for all pages. If a little icon appears in the right bottom corner of the page, it is successfully done.

Configurations

  • port: Server port, default to 3000.
  • logPath: Log path, also path for saving http requests.
  • ip: Ip list to allow access, see ip-filter.
  • forwardId: Add request id to url, default to false.
  • filterType: Response type to save requests, html and json only by default.
  • filter: Filters for response content processing.
  • password: Password to bypass ip filter, false to turn it off.
  • proxy: Proxy setting for different sites, see test/index.js as an example.

License

FreeGo is released under the MIT license. Please see LICENSE for full details.

0.3.2

7 years ago

0.3.1

7 years ago

0.3.0

7 years ago

0.2.4

7 years ago

0.2.3

7 years ago

0.2.2

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago

0.0.8

8 years ago

0.0.7

8 years ago

0.0.6

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago