So, I have progressed a little with my former issue although things still not working.
To review…I am using port forwarding for various ports to an haproxy server installed on an LXD container.
I also have a container LPC1 with nginx serving pages.
Then I have the following simple frontend:
frontend www_http
bind *:80 #bind to port 80
# it matches if the http host: field mentions any of the hostnames (after the '-i').
acl host_LPC1 hdr(host) -i lpc1.streamingworld.us
# Redirect the connection to the proper server container, depending on the match.
use_backend cont_LPC1 if host_LPC1
backend cont_LPC1
balance leastconn
# We set the X-Client-IP HTTP header. This is useful if we want the web server to know the real client IP.
http-request set-header X-Client-IP %[src]
# This backend, named here “LPC1”, directs to container “LPC1.lxd”.
server LPC1 LPC1.lxd:80 check
This appears to work as I can display the index.html. Now inside the index.html, I have an iFrame with the src= port 3000 of the same container (LPC1.lxd), so here is what I thought would work for the haproxy:
frontend play
bind *:3000
acl url_static hdr(host) -i lpc1.streamingworld.us/embed/0x35e01199f8137077346fdd476191f1967a52bdb5
use_backend static if url_static
backend static
balance leastconn
#http-request set-header X-Client-IP %[src]
server LPC1play LPC1.lxd:3000 check
I am not sure of either front or backend configurations?
When I run sudo haproxy -f /etc/haproxy/haproxy.cfg -c
Configuration file is valid
But when I restart haproxy, I get:
Mar 9 15:28:44 HAPROXY haproxy[13210]: [WARNING] 067/144947 (13210) : Exiting Master process…
Mar 9 15:28:44 HAPROXY haproxy[13210]: [ALERT] 067/144947 (13210) : Current worker 13211 exited with code 143
Mar 9 15:28:44 HAPROXY haproxy[13210]: [WARNING] 067/144947 (13210) : All workers exited. Exiting… (143)
Mar 9 15:28:44 HAPROXY haproxy[13237]: Proxy www_http started.
Mar 9 15:28:44 HAPROXY haproxy[13237]: Proxy www_http started.
Mar 9 15:28:44 HAPROXY haproxy[13237]: Proxy www_https started.
Mar 9 14:49:47 HAPROXY haproxy[13211]: backend static has no server available!
Mar 9 15:28:44 HAPROXY haproxy[13238]: Server static/LPC1play is DOWN, reason: Layer4 connection problem, info: “Connection refused”, check duration: 0ms. 0 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
Mar 9 15:28:44 HAPROXY haproxy[13238]: Server static/LPC1play is DOWN, reason: Layer4 connection problem, info: “Connection refused”, check duration: 0ms. 0 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
Mar 9 15:28:44 HAPROXY haproxy[13238]: backend static has no server available!
Mar 9 15:28:44 HAPROXY haproxy[13237]: Proxy www_https started.
Mar 9 15:28:44 HAPROXY haproxy[13237]: Proxy play started.
Mar 9 15:28:44 HAPROXY haproxy[13237]: Proxy play started.
Mar 9 15:28:44 HAPROXY haproxy[13237]: Proxy static started.
Mar 9 15:28:44 HAPROXY haproxy[13237]: Proxy static started.
Mar 9 15:28:44 HAPROXY haproxy[13237]: Proxy cont_LPC1 started.
Mar 9 15:28:44 HAPROXY haproxy[13237]: Proxy cont_LPC1 started.
Mar 9 15:28:44 HAPROXY haproxy[13237]: Proxy subdomain1 started.
First I’m not sure why I am seeing double outputs?
But worse, why the connection refused?
Your help us much appreciated!
Ray