# Content delivery to a docker container?

**URL:** <https://discourse.haproxy.org/t/content-delivery-to-a-docker-container/6218>\
**Category:** Help!\
**Created:** [February 4, 2021, 2:56pm UTC](https://discourse.haproxy.org/t/content-delivery-to-a-docker-container/6218 "2021-02-04T14:56:51Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![qwrty](https://avatars.discourse-cdn.com/v4/letter/q/f1d935/32.png) [@qwrty](https://discourse.haproxy.org/u/qwrty)\
**Post date:** [February 4, 2021, 2:56pm UTC](https://discourse.haproxy.org/t/content-delivery-to-a-docker-container/6218/1 "2021-02-04T14:56:51Z")

</div>

Hey folks,

I’m using filestash ([GitHub - mickael-kerjean/filestash: 🦄 A modern web client for SFTP, S3, FTP, WebDAV, Git, Minio, LDAP, CalDAV, CardDAV, Mysql, Backblaze, ...](https://github.com/mickael-kerjean/filestash)) with docker, default listening port is 8334, working great locally and on the same network =\> [http://192.168.1.100:8334](http://192.168.1.100:8334)

Haproxy is intalled on Debian (not into a docker container)

I made my content delivery rules like all my others self hosted services:

> ```
> global
> log /dev/log	local0
> log /dev/log	local1 notice
> chroot /var/lib/haproxy
> stats socket /run/haproxy/admin.sock mode 660 level admin expose-fd listeners
> stats timeout 30s
> user haproxy
> group haproxy
> daemon
> # Default SSL material locations
> ca-base /etc/ssl/certs
> crt-base /etc/ssl/private
> ssl-default-bind-ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:RSA+AESGCM:RSA+AES:!aNULL:!MD5:!DSS
> ssl-default-bind-options no-sslv3
> tune.ssl.default-dh-param 2048
> 
> defaults
> log	global
> mode	http
> option	httplog
> option	dontlognull
> timeout connect 5000
> timeout client 50000
> timeout server 50000
> errorfile 400 /etc/haproxy/errors/400.http
> errorfile 403 /etc/haproxy/errors/403.http
> errorfile 408 /etc/haproxy/errors/408.http
> errorfile 500 /etc/haproxy/errors/500.http
> errorfile 502 /etc/haproxy/errors/502.http
> errorfile 503 /etc/haproxy/errors/503.http
> errorfile 504 /etc/haproxy/errors/504.http
> 
> frontend http
> bind :5080
> option http-server-close
> option forwardfor
> 
> frontend https
> bind :5443 ssl crt /etc/ssl/private/mykeyxxxxxxx.pem
> option http-server-close
> option forwardfor
> rspirep ^Location:\ http://(.*)$ Location:\ https://\1
> rspadd Strict-Transport-Security:\ max-age=31536000;\ includeSubDomains
> 
> use_backend filestash if { hdr_beg(Host) -i filestash. }
> 
> backend filestash
> server filestash 127.0.0.1:8334 check
> 
> ```

But it doesnt work, page return to me a 504 Gateway Time-out whe using external address: [https://filestash.domain.com](https://filestash.domain.com)

Haproxy log:

> Feb 4 15:49:56 haproxy[17071]: 192.168.1.254:50115 [04/Feb/2021:15:49:06.584] https~ filestash/filestash 0/0/0/-1/50001 504 195 - - sH-- 1/1/0/0/0 0/0 “GET / HTTP/1.1”  
> Feb 4 15:50:46 haproxy[17071]: 192.168.1.254:50177 [04/Feb/2021:15:49:56.775] https~ filestash/filestash 0/0/0/-1/50002 504 195 - - sH-- 1/1/0/0/0 0/0 “GET /favicon.ico HTTP/1.1”

(I’m NATed, 192.168.1.254 is my default gateway)

I know Docker create it’s own network rules and interfaces and that can be messy, but if it works locally with [http://192.168.1.100:8334](http://192.168.1.100:8334), why it’s not working with Haproxy in front ?

I have no issue at all with my others hosted services (no docker) when using same settings in Haproxy configuration.

I guess something is wrong with my Haproxy configuration when using it to delivery content to a docker container ?

Thank you 🙂

---

<div class="post-metadata">

**Author:** ![lukastribus](https://avatars.discourse-cdn.com/v4/letter/l/7ea924/32.png) [@lukastribus](https://discourse.haproxy.org/u/lukastribus)\
**Post date:** [February 4, 2021, 4:27pm UTC](https://discourse.haproxy.org/t/content-delivery-to-a-docker-container/6218/2 "2021-02-04T16:27:50Z")

</div>

What does `curl -vv http://127.0.0.1:8334/` from the haproxy box show?

Are you sure 8334 is reachable on 127.0.0.1 also? Couldn’t it just be bound to `192.168.1.100:8334`?

---

<div class="post-metadata">

**Author:** ![qwrty](https://avatars.discourse-cdn.com/v4/letter/q/f1d935/32.png) [@qwrty](https://discourse.haproxy.org/u/qwrty)\
**Post date:** [February 4, 2021, 4:32pm UTC](https://discourse.haproxy.org/t/content-delivery-to-a-docker-container/6218/3 "2021-02-04T16:32:02Z")

</div>

Thank you Lukastribus,

I already tried to bind 192.168.1.100:8334 =\> same issue.

And curl on the server box give me:

![image](https://us1.discourse-cdn.com/flex016/uploads/haproxy/original/2X/d/d92faa59cc00f9cda444775f1e345a4dddcdf5b9.png)

---

<div class="post-metadata">

**Author:** ![lukastribus](https://avatars.discourse-cdn.com/v4/letter/l/7ea924/32.png) [@lukastribus](https://discourse.haproxy.org/u/lukastribus)\
**Post date:** [February 4, 2021, 4:37pm UTC](https://discourse.haproxy.org/t/content-delivery-to-a-docker-container/6218/4 "2021-02-04T16:37:52Z")

</div>

So you see that there is nothing responding on port `8334` here. Haproxy cannot reach your backend server just as curl can’t reach it.

I don’t know what the root cause is, but it’s not your haproxy configuration.

---

<div class="post-metadata">

**Author:** ![qwrty](https://avatars.discourse-cdn.com/v4/letter/q/f1d935/32.png) [@qwrty](https://discourse.haproxy.org/u/qwrty)\
**Post date:** [February 4, 2021, 4:42pm UTC](https://discourse.haproxy.org/t/content-delivery-to-a-docker-container/6218/5 "2021-02-04T16:42:15Z")

</div>

Thnak you,

I find that server only listening with IPV6 on 8334 ?  
Maybe that’s the answer

> root@LINOLOGY:~# netstat --listen | grep 8334  
> tcp6 0 0 [::]:8334 [::]:\* LISTEN

But other services which are working great when using only ipv6.

This issue is very weird…

---

<div class="post-metadata">

**Author:** ![lukastribus](https://avatars.discourse-cdn.com/v4/letter/l/7ea924/32.png) [@lukastribus](https://discourse.haproxy.org/u/lukastribus)\
**Post date:** [February 4, 2021, 4:58pm UTC](https://discourse.haproxy.org/t/content-delivery-to-a-docker-container/6218/6 "2021-02-04T16:58:47Z")

</div>

Does `curl -vvg "http://[::1]/"` work?

Then `server filestash ::1:8334 check` should too.

---

<div class="post-metadata">

**Author:** ![qwrty](https://avatars.discourse-cdn.com/v4/letter/q/f1d935/32.png) [@qwrty](https://discourse.haproxy.org/u/qwrty)\
**Post date:** [February 4, 2021, 5:14pm UTC](https://discourse.haproxy.org/t/content-delivery-to-a-docker-container/6218/7 "2021-02-04T17:14:44Z")

</div>

No chance, same as ipv4 😕

---

<div class="post-metadata">

**Author:** ![qwrty](https://avatars.discourse-cdn.com/v4/letter/q/f1d935/32.png) [@qwrty](https://discourse.haproxy.org/u/qwrty)\
**Post date:** [February 4, 2021, 6:07pm UTC](https://discourse.haproxy.org/t/content-delivery-to-a-docker-container/6218/8 "2021-02-04T18:07:46Z")

</div>

I think the issue is route related between containers and local machine.

---

<div class="post-metadata">

**Author:** ![lukastribus](https://avatars.discourse-cdn.com/v4/letter/l/7ea924/32.png) [@lukastribus](https://discourse.haproxy.org/u/lukastribus)\
**Post date:** [February 4, 2021, 8:26pm UTC](https://discourse.haproxy.org/t/content-delivery-to-a-docker-container/6218/9 "2021-02-04T20:26:30Z")

</div>

Does `curl -vv http://192.168.1.100:8334/` work then?

---

<div class="post-metadata">

**Author:** ![qwrty](https://avatars.discourse-cdn.com/v4/letter/q/f1d935/32.png) [@qwrty](https://discourse.haproxy.org/u/qwrty)\
**Post date:** [February 4, 2021, 8:35pm UTC](https://discourse.haproxy.org/t/content-delivery-to-a-docker-container/6218/10 "2021-02-04T20:35:53Z")

</div>

I changed haproxy configuration to `server filestash 192.168.1.100:8334 check`

And tried `curl -vv http://192.168.1.100:8334/`

Same issue =\> timeout  
But working great from another computer on the same local network.

No issue with my other services running locally without docker.  
It’s related to the docker network with bridge, etc…  
But can’t figure out the issue 😕
