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

Haproxy setup help

Scheduled Pinned Locked Moved General pfSense Questions
37 Posts 2 Posters 13.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.
  • R
    rajbps
    last edited by Oct 26, 2016, 7:04 PM

    Could you provide a screenshot pls. Cant seem to get my head round it.

    1 Reply Last reply Reply Quote 0
    • P
      PiBa
      last edited by Oct 26, 2016, 7:17 PM

      Something like this.

      ![2016-10-26 21_16_17-pfSe.localdomain - HAProxy_ Frontend_ Edit.png](/public/imported_attachments/1/2016-10-26 21_16_17-pfSe.localdomain - HAProxy_ Frontend_ Edit.png)
      ![2016-10-26 21_16_17-pfSe.localdomain - HAProxy_ Frontend_ Edit.png_thumb](/public/imported_attachments/1/2016-10-26 21_16_17-pfSe.localdomain - HAProxy_ Frontend_ Edit.png_thumb)

      1 Reply Last reply Reply Quote 0
      • R
        rajbps
        last edited by Oct 26, 2016, 9:18 PM

        Hiya, the "scheme https" is that the main front end for https or the shared front end which uses https front end as primary please?

        1 Reply Last reply Reply Quote 0
        • P
          PiBa
          last edited by Oct 26, 2016, 9:32 PM

          It just redirects the client from http://support to https://support, so after that initial http request the 'usual route' for that website will end up on one of your frontends that listen on :443.

          1 Reply Last reply Reply Quote 0
          • R
            rajbps
            last edited by Oct 26, 2016, 9:38 PM

            is there a way for me to get the config out of pfsense and send it to you in private pls?

            1 Reply Last reply Reply Quote 0
            • P
              PiBa
              last edited by Oct 26, 2016, 9:42 PM

              The generated haproxy configuration can be seen at the bottom of the settings tab in the package, there is a button to show it.

              As for getting it to me you could send me a PM through the forum if thats ok for you?. Anyhow replace passwords/public ip's/domainnames by similar but dummy values where needed. (do make sure to replace a name or ip you want to replace by the same value each time so it still makes sense..)

              1 Reply Last reply Reply Quote 0
              • R
                rajbps
                last edited by Oct 26, 2016, 10:03 PM

                pm sent

                1 Reply Last reply Reply Quote 0
                • P
                  PiBa
                  last edited by Oct 26, 2016, 10:12 PM

                  Config recieved. Looks like you didnt configure the 'action' part from my screenshot above?

                  Is the redirect the only current issue.? Or are there others i should look at?

                  1 Reply Last reply Reply Quote 0
                  • R
                    rajbps
                    last edited by Oct 26, 2016, 10:14 PM

                    thats the bit and if you can see anything to harden security thats always welcome

                    1 Reply Last reply Reply Quote 0
                    • P
                      PiBa
                      last edited by Oct 26, 2016, 10:29 PM

                      Ok so add the redirect 'action' as in my screenshot ? I think that should fix the redirect part.

                      As a minor observation i'm wondering about for example 'email' and 'support' are using different acl's matches v.s. contains is that intentional? should othersubdomain.support.mydomain.com also be send to the same backend as support.mydomain.com ?

                      You passing https straight to the backend, and using transparent-client-ip, should work.. and i assume you have read the warning, and understand it can cause some issues.. (it might bite you later when you want to connect another way and cant seem to get it working, the 'transparent-client-ip' might be the culprit..) Though there arn't really much other options for some backends.. Just saying ;)

                      1 Reply Last reply Reply Quote 0
                      • R
                        rajbps
                        last edited by Oct 26, 2016, 10:46 PM

                        when I add the second bit and try to save and apply, I get the following error :

                        Errors found while starting haproxy
                        [ALERT] 299/234604 (87967) : parsing [/var/etc/haproxy_test/haproxy.cfg:39] : error detected in frontend 'Loki-merged' while parsing 'http-request redirect' rule : expects 'code', 'prefix', 'location', 'scheme', 'set-cookie', 'clear-cookie', 'drop-query' or 'append-slash' (was 'Support').
                        [ALERT] 299/234604 (87967) : Error(s) found in configuration file : /var/etc/haproxy_test/haproxy.cfg

                        1 Reply Last reply Reply Quote 0
                        • R
                          rajbps
                          last edited by Oct 26, 2016, 10:48 PM

                          http-request redirect See below httpsredirect

                          rule: Support

                          1 Reply Last reply Reply Quote 0
                          • R
                            rajbps
                            last edited by Oct 26, 2016, 10:54 PM

                            "As a minor observation i'm wondering about for example 'email' and 'support' are using different acl's matches v.s. contains is that intentional? should othersubdomain.support.mydomain.com also be send to the same backend as support.mydomain.com ?"

                            In regards to the email and support, if i got it correctly, i have a different backend for each url as they go to different servers. Then I have one https frontend and sub frontend that share the primary https front end. If there is a better more efficient way to do it please advise as I am very new to haproxy and this is a learning curve for me .

                            Cheers for all the help though.

                            Rajbps

                            1 Reply Last reply Reply Quote 0
                            • P
                              PiBa
                              last edited by Oct 26, 2016, 10:56 PM

                              @rajbps:

                              http-request redirect See below httpsredirect

                              rule: Support

                              For a simple https redirect the 'rule' should be:

                              scheme https
                              

                              no more no less :)

                              1 Reply Last reply Reply Quote 0
                              • R
                                rajbps
                                last edited by Oct 26, 2016, 10:58 PM

                                yep error gone  :-)

                                1 Reply Last reply Reply Quote 0
                                • P
                                  PiBa
                                  last edited by Oct 26, 2016, 11:06 PM

                                  The usage of multiple backends and acl's is good. And it will probably work OK.

                                  The question i got was for example about these acl's:

                                     acl         OWA   req.ssl_sni -i email.mydomain.com
                                     acl         Support   req.ssl_sni -m sub -i support.mydomain.com
                                  

                                  Where email is using an 'exact match', the other for support is checking if the it is 'part of' the requested domain. I would expect a little that you would use "Server Name Indication TLS extension matches:" for all those acl expression's, and not have a few with "Server Name Indication TLS extension contains:".

                                  If it would look like this it would probably be a little better, though probably it wouldnt make much of a difference :)..

                                     acl         OWA   req.ssl_sni -i email.mydomain.com
                                     acl         Support   req.ssl_sni -i support.mydomain.com
                                  
                                  1 Reply Last reply Reply Quote 0
                                  • R
                                    rajbps
                                    last edited by Oct 28, 2016, 10:31 PM

                                    Is there a way to get a log of ips of live connections to the webservers please?

                                    1 Reply Last reply Reply Quote 0
                                    • P
                                      PiBa
                                      last edited by Oct 28, 2016, 11:44 PM

                                      The dashboard widget has the ability to show currently connected clients..
                                      But best is probably to run a syslog server on the network and let haproxy send its syslog messages there. On the settings tab og haproxy package you can fill in the syslog server to send the udp traffic to.

                                      1 Reply Last reply Reply Quote 0
                                      • R
                                        rajbps
                                        last edited by Nov 24, 2016, 12:04 AM

                                        Hi PiBA,

                                        I have exchange running behind haproxy fine and just added a new server with a new domain and vlan and that works well for webinterface but not for connecting the phones. Email box is Iredmail. If I redirect all https traffic direct to that Iredmail box then the phone will connect from external but as soon as i put haproxy in the mix I get stuck. Could you advise please?

                                        Rajbps

                                        1 Reply Last reply Reply Quote 0
                                        • P
                                          PiBa
                                          last edited by Nov 24, 2016, 6:39 PM

                                          Whats the config, what requests are send, why does your application not work? As i'm not using Iredmail and you haven't included much info about requests/configs/errors/logs there ain't much i can advice..

                                          1 Reply Last reply Reply Quote 0
                                          • 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