I have simple haproxy configuration: two servers, one is frontend, two is backend with jboss application. Here is config:

    mode                    http
    log                     global
    option                  httplog
    option                  dontlognull
    option http-server-close
    option forwardfor       except
    option                  redispatch
    retries                 3
    timeout http-request    10s
    timeout queue           1m
    timeout connect         10s
    timeout client          1m
    timeout server          1m
    timeout http-keep-alive 10s
    timeout check           10s
    maxconn                 3000
frontend  proxy
    bind ssl crt /etc/ssl/certs/certificate.pem
    default_backend             jboss
backend jboss
    #redirect scheme https if !{ ssl_fc }
    server      jboss check

I want to simplify url. Now if I want to enter to webapp I must type subdirectory in url https:// www.example.com/webapp/

I want to enter https:// www.example.com and haproxy will serve me page from How to do this?

  • Do you want HAproxy to rewrite the requests, or redirect the user?
    – GregL
    Aug 6, 2015 at 11:32
  • Have you tried Nginx?
    – Anatoly
    Aug 6, 2015 at 12:21
  • @GregL Initially I want to rewrite requests but links to graphics on webapp have absolute path. Problem was solved by redirecting from root to subdirectory.
    – QkiZ
    Aug 7, 2015 at 7:57

1 Answer 1


Problem solved by adding redirect in frontend section.

frontend  proxy
    bind ssl crt /etc/ssl/certs/certificate.pem
    acl path_root path /
    redirect location https://www.example.com/webapp/ if path_root
    default_backend             jboss

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.