gviaud icon

OpenWRT and HAProxy

gviaud | PRO | 05/31/17 10:49:50 PM UTC | 0 ⭐ | 310 👁️ | Never ⏰ | []
text |

2.47 KB

|

None

|

0 👍

/

0 👎

I wish to use HAProxy w/ OpenWRT to connect to my home network's various web-servers via subdomains from the internet.
 I currently have server1.mydomain.com and server2.mydomain.com DNS pointing to my local IP address.
 Example (connecting from outside of network):
 server1.mydomain.com should connect to webserver on my network, 192.168.1.100
server2.mydomain.com should connect to webserver on my network, 192.168.1.200
 This appears to work, but only from INSIDE my network (fails to connect when accessing from ourside) - not sure why or how to debug.
 Current HAProxy config looks like this:
 [code]# Global parameters                                   
global                                                    
        # Specifiy the maximum number of allowed connections.         
        maxconn 32000 
         # Raise the ulimit for the maximum allowed number of open socket
        # descriptors per process. This is usually at least twice the
        # number of allowed connections (maxconn * 2 + nb_servers + 1) .
        ulimit-n 65535
         # Drop privileges (setuid, setgid), default is "root" on OpenWrt.
        uid 0                                                           
        gid 0         
         # Daemonize on startup                                           
        daemon                   
         nosplice              
 listen http-in                                                      
        bind :80 
         # Define hosts                   
        acl host_server1 hdr(host) -i server1.mydomain.com
        acl host_server2 hdr(host) -i server2.mydomain.com
         ## Figure out which one to use                                  
        use_backend server1_cluster if host_server1
        use_backend server2_cluster if host_server2
 backend server1_cluster                            
        mode http                                          
        balance roundrobin                                            
        server server1 192.168.1.100:80 source 192.168.1.1
 backend server2_cluster
        mode http
        balance roundrobin
        server server2 192.168.1.200:80 source 192.168.1.1
[/code]

Comments