Inter-Container API Calls (fail with SSL)

Using lxd with 3 containers - Haproxy Container with SSL Passthrough (TCP mode), Wordpress Container (wordpress.domain.com) and ERP (domain erp.domain.com). Using IPtables to forward traffic from public IP to haproxy container. Both wordpress and erp containers have multiple virtual hosts resolved using host header (apache /nginx). Recently installed lets-encrypt certificates for each site and setup redirect https.

Able to access all websites on both containers (wordpress and erp) from the internet.

However unable to use webhooks or make any API calls between containers using the domain names. Cannot use container.lxd or lxd assigned container IP address as each container hosts multiple websites and needs http host header to resolve correctly.

Connection Refused on Port 80 (assuming due to https redirect) and Connection Fails (SSL error) on port 443. Will appreciate any insight …

Solved - do not know if right way. Created an entry in /etc/hosts file of the wordpress and erp containers mapping each virtual host to the IP address of the haproxy container. So all inter container traffic between hosts is also routed via the haproxy container.

Hi!

I think that the source of the problem is that you have setup SSL/TLS in each website container. Have you set it up that way?

You could get away with it by making HAProxy act as a TLS Termination proxy. The downside is that you would need to setup yourself the process of updating the Let’s Encrypt certificates, because HAProxy does not automate this for you.