1

Currently there are 3 applications running on their respective ports(5000,30000 and
32000).All these application are working at their respective ports.Now i want to map these 3 applications using an alias name with the help of haproxy.

What i have tried


frontend frontend1
    mode    http
    bind *:8080
    bind *:443 ssl crt /etc/ssl/private/mydomain.pem
    http-request redirect scheme https code 301 if !{ ssl_fc }


    acl path-processdesigner              path_beg -i /
    use_backend backend3               if path-processdesigner
    acl path-processdesigner              path_beg -i /processdesigner
    use_backend backend3               if path-processdesigner

frontend frontend2
    mode    http
    bind *:8000
    bind *:443 ssl crt /etc/ssl/private/mydomain.pem
    http-request redirect scheme https code 301 if !{ ssl_fc }

    acl path-processcore                  path_beg -i /
    use_backend backend2               if path-processcore
    acl path-processcore              path_beg -i /processcore
    use_backend backend2               if path-processcore

frontend frontend3
    mode    http

    bind *:80

    acl path-employeeList                 path_beg -i /index
    use_backend backend1               if path-employeeList


backend backend1
    mode    http

    option  httplog
    option  forwardfor
    reqrep  ^([^\ :]+)\ /index/?(.*)$  \1\ /\2

    server  backend1  206.189.22.155:32000


backend backend2
    mode    http

    option  httplog
    option  forwardfor
    reqrep  ^([^\ :]+)\ /processcore/?(.*)$  \1\ /\2

    server  backend2 206.189.22.155:5000

backend backend3
    mode    http

    option  httplog
    option  forwardfor
    reqrep  ^([^\ :]+)\ /processdesigner/?(.*)$  \1\ /\2

    server  backend2 206.189.22.155:30000


using this config i can access https://206.189.22.155/processdesigner and http://206.189.22.155/index but when i hit https://206.189.22.155/processcore i get 404 not found.Now if i remove frontend frontend1 from the config completely then https://206.189.22.155/processcore works and shows output.Why does it work only when i remove the frontend1 completely?How can i fix this ? Plz help

NOTE: All the application are working on their respective ports ie, at http://206.189.22.155:5000/,http://206.189.22.155:32000/ and http://206.189.22.155:30000/.

0

You have two frontends listening on the same port 443 but only the first frontend will match all request coming on port 443.

7
  • i tried removing the bind 443 but even then it does not work – Vignesh Swaminathan Oct 17 '19 at 7:30
  • my goal is just to use the alias name instead of port number in the url – Vignesh Swaminathan Oct 17 '19 at 7:31
  • @VigneshSwaminathan, port 443 is the default port for https:// requests and used even if you don't specify a port in the URL. You need to rewrite your configuration to have only one frontend with bind 443. – AlexD Oct 17 '19 at 16:35
  • okay i rewrote the config for only single frontend with bind 443.Can you plz check the update/edited question – Vignesh Swaminathan Oct 21 '19 at 10:25
  • @VigneshSwaminathan the issue in your edit is different from your original question so you need to post a separate question. – AlexD Oct 21 '19 at 11:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.