Haproxy in front of containers....more!

How can I add port forwarding from another host? It must be on my VPS (23.239.31.177)?

Never mind. I should read better.

This line is wrong. It should be just server LPC1play LPC1.lxd:3000.

You are missing in your www frontend a default backend to handle the case when the domain doesn’t match lpc1. (Perhaps this is the static backend?)

I already fixed that.

backend static
        #server LPC1play lpc1.streamingworld.us:3000/embed/0x35e01199f8137077346fdd476191f1967a52bdb5
        server LPC1play LPC1.lxd:3000

Which frontend?

This one: frontend www_http.


P.S.: I would strongly suggest that you (re)read the HAProxy documentation as it describes a lot of the best-practices and pin-points some issues you are facing.

I think you have skipped this part and just tried to copy-paste things you’ve found here and there. This won’t work. (I apologize in advance if this is not the case.)

The issue with everything I read about haproxy is it iis geared towards load balancing. I am not doing load balancing. So I have no idea what to put as default_backend?

So it seems the only curl that works is:
curl https://lpc1.streamingworld.us

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Welcome to Nginx on LPC1!</title>
<style>
    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
    }
</style>
</head>
<body>
<h1>Welcome to Nginx!</h1>
<h1>You are in LPC1!</h1>
<p>If you see this page, the nginx  web server is successfully installed and
working. Further configuration may be required.</p>

<p><em>Thank you for using Nginx.</em></p>

<!-- <iframe  width="640" height="360" src="LPC1.lxd:3000/Embed/0x35e01199f8137077346fdd476191f1967a52bdb5" frameborder="0"></iframe> -->

<!-- <iframe  width="640" height="360" src="http://23.239.31.177:3000/Embed/0x35e01199f8137077346fdd476191f1967a52bdb5" frameborder="0" sandbox="allow-same-origin"></iframe> -->

<!-- <iframe  width="640" height="360" src="/livepeerjs/packages/player/public/index.html" name="myFrame"></iframe>
     <a href="http://LPC1.lxd:3000" target="myFrame"></a> -->

<iframe  width="640" height="360" src="https://lpc1.streamingworld.us:3000/embed/0x35e01199f8137077346fdd476191f1967a52bdb5" frameborder="1"></iframe>

<!-- <iframe width="640" height="360" src="http://lpc1.streamingworld.us:3000/Embed/0x35e01199f8137077346fdd476191f1967a52bdb5" sandbox="allow-same-origin allow-scripts" frameborder="1"></iframe> -->

<!-- <object data="https://lpc1.streamingworld.us:3000/embed/0x35e01199f8137077346fdd476191f1967a52bdb5" width="400" height="300" type="video/MP2T">
    Alternative Content
</object> -->

</body>
</html>

Note the iframe. This is what was initially not working!

Having only one server is a special case of the more generic one of having multiple servers. :slight_smile:

Leaving that asside, HAProxy is useful for many other use-cases such as TLS termination or WAF.


Again, I have to point you to read the actual HAProxy documentation:

http://cbonte.github.io/haproxy-dconv/1.8/intro.html

The default backend is the one that has the server that should handle the case when no ACL’s have been matched and no other backends have been explicitly selected. My guess is that it’s the static one?

So, when I curl https://lpc1.streamingworld.us I get back the html code. But when I browse the same url, I get the site can’t be reached?

Check that the browser and the curl see the same IP tied to the same domain-name.

(I.e. check in development mode with Firefox in the request, and for curl use -v -s and see at the beginning. Also try to dig the domain name. Also check /etc/hosts so there are no leftover records after the previous experiment.)

Also, take into account that you have forwarding rules in place.