Header forward with auto switch
Posted: Mon Sep 05, 2011 8:45 am
If you have many http servers with many domains, you can setup Header forward with auto switch. The purpose of using auto switch is to provide a load balancing control. If main http server has no response or late response (ie. 5 seconds), http request will forward to defined spare server. Such auto switch will
The following example will show the setting of 2 domains with 4 servers.
Magic Router ip: 192.168.1.1, public ip is 59.148.187.182
Domain 1: www.magicrouter.net, main server ip: 192.168.1.2, spare server ip: 192.168.1.3
Domain 2: www.my8z.com, main server ip: 192.168.1.4, spare server ip: 192.168.1.5
Steps and setting
1. Startup Magic Router as main router for header forward.
a) If header found www.magicrouter.net, forward to 192.168.1.2
b) If header found www.my8z.com, forward to 192.168.1.4
2. Standard routing listen port is 80, to port = 80, to host = 192.168.1.2, as the default http if header not match.
3. Enabled header forward, and input the following definition
www.magicrouter.net, 127.0.0.1,81
www.my8z.com, 127.0.0.1,82
4. Start up 2nd Magic Router on same computer as main Magic Router.
5. Listen port = 81, to port = 80, to host = 192.168.1.2.
6. Set up auto switch: Enabled, input spare server definition: 192.168.1.3,80
7. Start up 3rd Magic Router on same computer as main Magic Router.
8. Listen port = 82, to port = 80, to host = 192.168.1.4.
9. Set up auto switch: Enabled, input spare server definition: 192.168.1.5,80
After settings, you have 4 servers to service http, and 3 Magic Routers in main server to control http service.
If your http support header detection (domain), no header forward is required, put all spare server on 1st Magic Router.
Spare server definition:
192.168.1.2,80
192.168.1.3,80
192.168.1.4,80
192.168.1.5,80
The following example will show the setting of 2 domains with 4 servers.
Magic Router ip: 192.168.1.1, public ip is 59.148.187.182
Domain 1: www.magicrouter.net, main server ip: 192.168.1.2, spare server ip: 192.168.1.3
Domain 2: www.my8z.com, main server ip: 192.168.1.4, spare server ip: 192.168.1.5
Steps and setting
1. Startup Magic Router as main router for header forward.
a) If header found www.magicrouter.net, forward to 192.168.1.2
b) If header found www.my8z.com, forward to 192.168.1.4
2. Standard routing listen port is 80, to port = 80, to host = 192.168.1.2, as the default http if header not match.
3. Enabled header forward, and input the following definition
www.magicrouter.net, 127.0.0.1,81
www.my8z.com, 127.0.0.1,82
4. Start up 2nd Magic Router on same computer as main Magic Router.
5. Listen port = 81, to port = 80, to host = 192.168.1.2.
6. Set up auto switch: Enabled, input spare server definition: 192.168.1.3,80
7. Start up 3rd Magic Router on same computer as main Magic Router.
8. Listen port = 82, to port = 80, to host = 192.168.1.4.
9. Set up auto switch: Enabled, input spare server definition: 192.168.1.5,80
After settings, you have 4 servers to service http, and 3 Magic Routers in main server to control http service.
If your http support header detection (domain), no header forward is required, put all spare server on 1st Magic Router.
Spare server definition:
192.168.1.2,80
192.168.1.3,80
192.168.1.4,80
192.168.1.5,80