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

HAproxy : How to mix SSL forwarding and Reverse Proxy with SSL termination

Scheduled Pinned Locked Moved Cache/Proxy
9 Posts 2 Posters 2.7k 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
    smalldragoon
    last edited by Mar 18, 2022, 6:10 PM

    Hi,

    First, I'm running pfsense 2.5.2-RELEASE (amd64) built on Fri Jul 02 15:33:00 EDT 2021 and HAProxy version 1.8.30-c248dab, released 2021/04/12.

    I had until now Haproxy as reverse proxy for a website with 2 servers in https - > working. ( HAProxy + ACME for certs)
    PFSense was doing reverse proxy / load balancing SLL Offloading to to my 2 servers in http as backend

    Now, I have another website, a single host, which manage his certificate alone.
    I checked and if I expose it to 443 with NAT basic port forwarding, it works.
    I try few config and still do not manage to get both working through the reverse proxy.

    First, is this possible ?
    I would need to have both setup behind my pfsense ( single IP address )
    I understood that selecting tcp/ssl instead of offloading should do the trick, but I get only connection refused and errors.

    Anyone woul have insights ?
    Thanks !

    1 Reply Last reply Reply Quote 0
    • S
      smalldragoon
      last edited by Apr 7, 2022, 9:08 AM

      up ?
      Am I asking something not possible maybe ?

      V 1 Reply Last reply Apr 7, 2022, 4:38 PM Reply Quote 0
      • V
        viragomann @smalldragoon
        last edited by Apr 7, 2022, 4:38 PM

        @smalldragoon
        Maybe this can help: https://github.com/PiBa-NL/pfsense-haproxy-package-doc/wiki/pfsense_2_3_haproxy_sni_plus_offloading_backends

        S 1 Reply Last reply Apr 8, 2022, 10:49 AM Reply Quote 1
        • S
          smalldragoon @viragomann
          last edited by Apr 8, 2022, 10:49 AM

          @viragomann Thanks a lot ! seems to answer perfectly my question
          will do some tests....

          S 1 Reply Last reply Apr 28, 2022, 10:16 AM Reply Quote 0
          • S
            smalldragoon @smalldragoon
            last edited by smalldragoon Apr 28, 2022, 10:25 AM Apr 28, 2022, 10:16 AM

            @viragomann
            Hi , i made many tests and it is not happening the same way than it is describe in the doc, as it is slighly different, let me reshare all the details & config to see what am I missing ...

            I have 1 single public IP address,
            I need the following at the same time :

            I have a domain , smalldragoon.com , where

            • A1 - A.smalldragoon.com, B.smalldragoon.com, C.smalldragoon.com need to be forwarded to an internal which is managing the SSL connection ( equivalent to my old config which was just port forwarding of the 443)
            • A2 - D.smalldragoon.com need to have its SSL communication terminated on PFSense and redirected to an internal host which is running on port 80 ( so not in https , it is a basic website).
              Ex : https://D.smalldragoon.com redirect to http://192.168.1.1:80

            I have a second domain : smalldragoon.xyz, where

            B1 - I want to terminate the SSL connection on pfsense. Now based on the directory of the URL, do redirection to an internal host with different ports, example :
            https://test.smalldragoon.xyz/A redirect to http://internalhost:4545/A
            https://test.smalldragoon.xyz/B redirect to http://internalhost:4546/B

            B2 - Last, with the same domain smalldragoon.xyz, I need to redirect all hosts traffic from a subdomain to an internal host as is ( no https termination )
            ex :
            https://.mysubdomain.smalldragoon.xyz to https://195.168.1.1/ ( which manage the ssl )*
            I need to have all these working at the same time.
            So to proceed in order ,
            what I have done :
            for A1 : ok and working
            created 1 front end, with the different hostname possible for the domain
            f21908ef-5cdc-41fa-8e91-a84928eabbd2-image.png
            and redirect to a backend :
            2b8cc822-e716-41b9-8bc9-5b577c9b4e44-image.png

            Now when I create A2 with a 2nd frontend
            afaa21ef-f84d-423c-a7ca-90dc8d54bf4c-image.png

            config of frontend
            1d54082f-3783-4690-bb52-d837418b0996-image.png

            d063623c-7cd2-4482-9c48-95696655796d-image.png
            when validating I get :

            563e0e09-514b-4945-b13f-80784120ed36-image.png

            I tried to merge the 2 frontends, but it is not working, so I assume there is somehting around shared frontends as per the message ? What am I missing ?
            Thanks

            V 1 Reply Last reply Apr 28, 2022, 10:48 AM Reply Quote 0
            • V
              viragomann @smalldragoon
              last edited by Apr 28, 2022, 10:48 AM

              @smalldragoon
              Yes, that's what I'd expect.
              You can set up only one frontend for a single IP + port combo, or even a shared frontend at best.

              However, in a single frontend you can configure multiple backends in conjunction with different ACLs.

              S 1 Reply Last reply Apr 28, 2022, 10:53 AM Reply Quote 1
              • S
                smalldragoon @viragomann
                last edited by Apr 28, 2022, 10:53 AM

                @viragomann
                ok, but so I'm not understading your answer. can I do A1 and A2 then or not ?
                I don't really care about the way to do it, as long as it works :)

                V 1 Reply Last reply Apr 28, 2022, 11:07 AM Reply Quote 0
                • V
                  viragomann @smalldragoon
                  last edited by Apr 28, 2022, 11:07 AM

                  @smalldragoon
                  I never did such setup myself. So I cannot tell you if it work. Just found the guide in the web, when I was searching for haproxy solutions.

                  As I understand it, it should be possible to get it work. But for A2 you have to configure pfSense itself as backend and forward the traffic from the unique frontend to it by checking out SNI.

                  S 1 Reply Last reply Apr 28, 2022, 12:22 PM Reply Quote 1
                  • S
                    smalldragoon @viragomann
                    last edited by Apr 28, 2022, 12:22 PM

                    @viragomann
                    OK, I will create another post with a more specific topic on shared frontend
                    thanks for your time and help !

                    1 Reply Last reply Reply Quote 0
                    • S smalldragoon referenced this topic on Apr 28, 2022, 12:33 PM
                    • First post
                      Last post
                    Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
                      This community forum collects and processes your personal information.
                      consent.not_received