Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Docker behind pfsense: haproxy, traefik, or ... ?

    Scheduled Pinned Locked Moved Cache/Proxy
    7 Posts 5 Posters 6.3k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      sgw
      last edited by

      As discussed in other threads here I am happily using HAproxy on pfsense to proxy https to various servers in my LANs. So far they are mostly VMs in a VMware Vsphere environment, they get static DHCP-leases from pfsense and things work out fine.

      Now I added docker ... and this introduces additional networking. I set up traefik as proxy container within docker ... and now I start to wonder how to do the "ideal setup": traefik could pull LE-certs via ACME by itself, but this would only work or make sense for the containers. Should I introduce a subdomain like "docker.my.tld" for this tree of containers ...

      I would like to learn how others handle a mixed environment like this and avoid any pitfalls.

      S 1 Reply Last reply Reply Quote 0
      • S
        sgw @sgw
        last edited by sgw

        Noone? ok ... I just add some thoughts here, maybe someone chimes in ...

        Did my first tests here and as far as I get it, it will be better to decide for one spot to do the SSL-termination.
        So far I couldn't get things working with both ACME on pfsense (managing the certs for pfsense itself and some already existing VMs) and additional traefik trying to pull certs for the docker containers.

        I assume it should be possible though ;-)

        If HAproxy on pfsense filters out all traffic going to ".docker.my.tld" and forwards that to the traefix-proxy things should work, I assume.

        Another option would be to run traefik for http only ... but then I lose much of the magic features it brings.

        1 Reply Last reply Reply Quote 0
        • P
          poppahorse
          last edited by

          I ended up getting stuck in the same situation. Ended up just getting rid of HAProxy and letting Traefik handle all proxying requirements.

          If I tried to use both, HAProxy would not recognise anything in Traefik and report with a 503.

          IMO Traefik is easier to config and use.

          M 1 Reply Last reply Reply Quote 0
          • P
            PackElend
            last edited by

            Wheredo you run traefik?
            Did you installed traefik on the pfSense machine?

            1 Reply Last reply Reply Quote 1
            • M
              menethoran @poppahorse
              last edited by

              @poppahorse any chance you can give a tutorial or a short write up of how you accomplished this? ive exhausted my google-fu trying to figure out how to get PfSense to play right with traefik (running traefik on a trueNAS scale box)

              johnpozJ 1 Reply Last reply Reply Quote 0
              • johnpozJ
                johnpoz LAYER 8 Global Moderator @menethoran
                last edited by johnpoz

                @menethoran this is a really old thread. But I run a few dockers, and have had a few of them exposed to the public internet through haproxy.

                I am not sure what the OP was doing, but in my docker setup the things I run are attached to the "bridge" network on the docker host. So anything you run could be accessed just via the docker host IP and the port your docker is exposing.

                It is also possible to run your dockers on the host network, and they could get another IP in the same network as your docker host. You can setup how docker does networking in a few different ways.

                https://docs.docker.com/network/

                Understanding how you have it setup, and or if you need to change this to accomplish your goal is direction I would suggest vs trying to fire up some other sort of proxy.. While should be pretty easy if you were running the reverse proxy actually on the host you running your dockers, running a reverse proxy on your network to send traffic to yet another host on your network etc can get convoluted very quickly.

                An intelligent man is sometimes forced to be drunk to spend time with his fools
                If you get confused: Listen to the Music Play
                Please don't Chat/PM me for help, unless mod related
                SG-4860 24.11 | Lab VMs 2.7.2, 24.11

                M 1 Reply Last reply Reply Quote 0
                • M
                  menethoran @johnpoz
                  last edited by menethoran

                  @johnpoz yeah, i actually created my own post thinking i didnt want to hijack his.

                  Please see here (I explain what im running):

                  https://forum.netgate.com/topic/169703/pfsense-and-traefik-on-truenas-scale

                  1 Reply Last reply Reply Quote 1
                  • First post
                    Last post
                  Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.