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

Redirection of JBoss web server using HAproxy with ACL

Scheduled Pinned Locked Moved Cache/Proxy
10 Posts 3 Posters 699 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.
  • W
    wesleylc1 Rebel Alliance
    last edited by wesleylc1 Oct 8, 2020, 2:30 AM Oct 8, 2020, 2:27 AM

    Dear friends,

    I publish some web servers externally using "pfsense 2.4.4-RELEASE-p3 + haproxy-devel", and use the "ACL" rules to redirect some subdomains that respond in two "Frontend" "http and https" and work successfully, but I am having trouble configuring "ACL" for a new "JBoss" server, when configuring the settings for external publishing, it does not direct the way I want.

    Below I will inform details of the settings applied in HAproxy:

    1) As shown, this server is using "http", responsive on port "8180", so I made the configuration of a new "Backend" applying the configurations below:

    backend0001.png

    2) In the "http" frotend, I configured a new ACL "gedproj-web" with the value "gedproj-web.projectus.com.br".

    ACL_0003.png

    3) Below in actions, I added a new responsive rule to ACL previously informed and associated to my new "JBoss" server.

    Action_0004.png

    Important: As previously mentioned, the web server is accessible externally, but when accessing it, it is redirected only to the application if the address [http://gedproj-web.projectus.com.br/gedproj/] is used, when using [http://gedproj-web.projectus.com.br/] is taken to the JBoss EAP 7 administration page

    Thanks in advance!

    1 Reply Last reply Reply Quote 0
    • K
      kiokoman LAYER 8
      last edited by Oct 8, 2020, 11:27 AM

      do you want to redirect? not 100% sure but:
      http-request redirect location http://web.projectus.com.br/gedproj/
      ?

      ̿' ̿'\̵͇̿̿\з=(◕_◕)=ε/̵͇̿̿/'̿'̿ ̿
      Please do not use chat/PM to ask for help
      we must focus on silencing this @guest character. we must make up lies and alter the copyrights !
      Don't forget to Upvote with the 👍 button for any post you find to be helpful.

      1 Reply Last reply Reply Quote 0
      • W
        wesleylc1 Rebel Alliance
        last edited by Oct 8, 2020, 2:25 PM

        Dear @kiokoman,

        As the image below shows, I already use the "http-request redirect" that redirects to my main site, and also to some subdomains, whose rule: site is already informed of my main site [http: //www.projectus. com.br] and in Condition Names acl inform conditions for the site [http://gedproj-web.projectus.com.br/gedproj/]

        Captura de tela de 2020-10-08 11-24-31.png

        1 Reply Last reply Reply Quote 0
        • W
          wesleylc1 Rebel Alliance
          last edited by Oct 20, 2020, 6:07 PM

          Any tips or suggestions to solve this problem?

          1 Reply Last reply Reply Quote 0
          • D
            dragoangel
            last edited by dragoangel Oct 26, 2020, 12:01 AM Oct 25, 2020, 11:58 PM

            Hi, you want to get site working under root path of domain and not as subpath?

            Then you need create on backend action:

            http-request set-path /gedproj%[path]
            

            Also: why you use http?! You can do easily pfsense ACME plugin + HAproxy acme lua script to get free let's encrypt ssl and then redirect all non /.well-known/acme-chalange to https

            Latest stable pfSense on 2x XG-7100 and 1x Intel Xeon Server, running mutiWAN, he.net IPv6, pfBlockerNG-devel, HAProxy-devel, Syslog-ng, Zabbix-agent, OpenVPN, IPsec site-to-site, DNS-over-TLS...
            Unifi AP-AC-LR with EAP RADIUS, US-24

            W 1 Reply Last reply Oct 26, 2020, 12:34 AM Reply Quote 0
            • W
              wesleylc1 Rebel Alliance @dragoangel
              last edited by wesleylc1 Oct 26, 2020, 12:40 AM Oct 26, 2020, 12:34 AM

              Hello @dragoangel I have the wildcard certificate "Wildcard certificate", as it is a new web server, at first I'm trying to adjust the redial rules, then I want to adjust to use this https server.

              The domain's root site responds at [projectus.com.br], this new application must respond as a subpath [gedproj-web.projectus.com.br/gedproj], redirects only when informing [/ gedproj]

              D 1 Reply Last reply Oct 26, 2020, 7:23 AM Reply Quote 0
              • D
                dragoangel @wesleylc1
                last edited by dragoangel Oct 26, 2020, 7:56 AM Oct 26, 2020, 7:23 AM

                @wesleylc1 I not understand why you say about one domain and then about other when. I don't understand what you want to achieve as you say many stuff but not right to your question. And not only I not understand you, so please can you speak more clear.

                If you already have SSL what a point configure all on http and then migrate it to https? This ridiculous wasting of own time.

                You want reject client if he go to gedproj-web.projectus.com.br and path not start with /gedproj ? Then this not hard: this sounds exactly I said, 2 ACL (this pseudo code, I writing from phone):
                acl example_site host = example.com
                acl path_gedproj path start with /gedproj
                And 1 action before use backend:
                http-request reject 503 if example_site !path_gedproj

                But I better in your case put the rewrite rule /gedproj to / and simply provide user access to site at / this much logically as I write in my first comment.

                For each new project on this server you will create new backend with rewrite to own path if you want have many projects.

                If you want have one project why you not follow:
                To replace this page simply deploy your own war with / as its context path.

                If as I understand correctly your / now is some sort of welcome panel and admin panel at /console etc. you simply can create another backend for /console and configure it to work on different domain. Optionally you can create ACL which will reject all requests from not whitelisted ips or allow access only from internal vpn network etc.

                P.s.: never understand paid certificate when you have letsencrypt, aspecialy now when you even can't buy ssl longer then 1 year.

                Latest stable pfSense on 2x XG-7100 and 1x Intel Xeon Server, running mutiWAN, he.net IPv6, pfBlockerNG-devel, HAProxy-devel, Syslog-ng, Zabbix-agent, OpenVPN, IPsec site-to-site, DNS-over-TLS...
                Unifi AP-AC-LR with EAP RADIUS, US-24

                1 Reply Last reply Reply Quote 0
                • W
                  wesleylc1 Rebel Alliance
                  last edited by Oct 27, 2020, 1:13 AM

                  @dragoangel unfortunately my bad English makes communication difficult, but I don't intend to reject the client when accessing [gedproj-web.projectus.com.br], but rather that he be redirected to the application's authentication page, as shown in the image below.

                  2020_10_26_21_20_03_GED_PROJ_Login.png

                  As you said ... "there is no reason to spend my time first configuring the application in http ... I already have a wildcard certificate, so I chose to use all this effort to apply https.

                  In fact I was spending all this time configuring as http and not as https simply because my application doesn't have the certificates configured on the web server yet, but my wildcard certificate is already correctly configured on the "pfsense" firewall, so I believe there is no impediment in configure the new backend in https.

                  In my environment I already have several backend servers using http or https frontend, I believe my https frontend was already using the suggested logic, so I just followed the logic already used and entered the information for this new project, as shown below.

                  frontend HA_Sistemas-https
                  	bind			189.20.XX.XX:443 name 189.20.XX.XX:443   ssl crt-list /var/etc/haproxy/HA_Sistemas-https.crt_list 
                  
                  acl rootrequested var(txn.txnpath) -m str -i /
                  acl appone var(txn.txnhost) -m str -i time-appone.projectus.com.br
                  acl gedproj-web var(txn.txnhost) -m str -i gedproj-web.projectus.com.br
                  
                  http-request set-var(txn.txnpath) path
                  http-request set-var(txn.txnhost) hdr(host)
                  http-request redirect location /appone/faces/login.xhtml  if  rootrequested appone
                  http-request redirect location /gedproj/  if  rootrequested gedproj-web 
                  use_backend HA_Sistemas_43-115_8443-gedproj-web_ipvANY  if  gedproj-web 
                  default_backend HA_Sistemas_43-235_8443_ipvANY 
                  
                  1 Reply Last reply Reply Quote 0
                  • D
                    dragoangel
                    last edited by dragoangel Oct 27, 2020, 7:16 AM Oct 27, 2020, 7:12 AM

                    This not matter how you know English, you can use translation software. I don't see any questions. I don't see where you asking for help and what is your issue - all you wrote is description of what you have now. You issue is solved or wasn't exist? 🤨

                    Latest stable pfSense on 2x XG-7100 and 1x Intel Xeon Server, running mutiWAN, he.net IPv6, pfBlockerNG-devel, HAProxy-devel, Syslog-ng, Zabbix-agent, OpenVPN, IPsec site-to-site, DNS-over-TLS...
                    Unifi AP-AC-LR with EAP RADIUS, US-24

                    W 1 Reply Last reply Oct 27, 2020, 6:01 PM Reply Quote 0
                    • W
                      wesleylc1 Rebel Alliance @dragoangel
                      last edited by Oct 27, 2020, 6:01 PM

                      @dragoangel Yes, it is already resolved, it is now possible to redirect successfully to my web application, and already using https, as shown in the image below.

                      Captura de tela de 2020-10-27 14-54-55.png

                      I take this opportunity to thank you and everyone who somehow interacted for a solution to my problem, grateful for all the support and patience in the instructions.

                      1 Reply Last reply Reply Quote 0
                      • First post
                        Last post
                      Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
                        [[user:consent.lead]]
                        [[user:consent.not_received]]