I am trying to show the user 443 port number . I have two url like below https://mainadmin.dev.example:8443/mainadmin https://studentblog.dev.example:8443/Studentblogpage but now , I want use change one url like https://studentblog.dev.example/Studentblogpage or https://studentblog.dev.example:443/Studentblogpage

Is it possible to change like below code ?

frontend port_8443
bind *:8443 ssl crt /etc/haproxy/ssl/certificate/crt.txt
reqadd X-Forwarded-Proto:\ https
acl mainadm path_reg -i ^/MainAdm.*$
acl StudentBlog path_reg -i ^/StudentSite.*$
use_backend MainAdm-Devl if { sslsni admmain.dev.example } Mainadm
use_backend Studentblog-Devl if { sslsni studentblog.dev.example } StudentBlog
mode http
option tcplog
backend MainAdm-Devl
mode http  
balance roundrobin
cookie SERVERID insert indirect nocache
server webserver01 server-01.dev.example:8443 ssl check verify none cookie a1
server webserver02 server-02.dev.example:8443 ssl check verify none cookie a2
backend Studentblog-Devl
mode http
balance roundrobin
option httpchk GET /Studentblogpage
cookie SERVERID insert indirect nocache
server webserver04 server-04.dev.example:443 ssl check verify none
server webserver05 server-05.dev.example:443 ssl check verify none backup
  • 2
    I don't understand your question. Are you trying to forward traffic from port 443 to 8443? – kelvintechie Jun 12 at 18:14
  • Yes, I want send traffic from 8443 to 443 . – Prasu Jun 13 at 14:16

There's actually numerous ways you could forward traffic from port 8443 to 443.

Firstly, you could use NAT and PAT (NAPT) to translate traffic with a dst. port of 8443 to a system on 443 (or vice versa as needed). That would be something you'd have to get in touch with a network administrator if you don't have administrative control over the routers on your network to configure this functionality and that's assuming that your network implements NAT/PAT (most private networks do to conserve IPv4 address space).

In keeping with your question though, if you wanted to do it based on configuration only, you could configure another front-end server and configure it to publicly listen to port 443 and then forward that traffic internally through a redirect.

Or, if this doesn't conflict in your environment, you could change your web servers to listen on 443 in the first place (though based on your question, it likely does).


Yes, you can use HAProxy to proxy port 443 or port 8443 and route it to servers on the backend that are listening on different ports. That's the beauty of using a proxy. Your frontend can have multiple 'bind' lines that each specify a different port to listen on.

When you use HAProxy to terminate SSL, as you are doing, then you get access to all of the information in the HTTP message. So, you can directly inspect the Host header in you ACL statements (you don't need to check SNI -- although you can, with the 'ssl_fc_sni' fetch method. 'sslsni' is not correct).

acl StudentBlog path_beg -i Studentblogpage
use_backend Studentblog-Devl if { req.hdr(Host) studentblog.dev.example  } StudentBlog

In this example, you are using the 'Studentblog-Devl' backend if both conditions are true:

  • Host header is 'studentblog.dev.example'
  • URL path begins with 'Studentblogpage'

If you only want to change the Studentblog to listen on port 443 and not the mainadmin site, then it's better to create two 'frontend's and separate them out so that they can listen on only the ports they should.

  • I'm going to admit that this is a much better solution than mine 😊 – kelvintechie Jun 14 at 22:19

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.