I must request how HAProxy might help in routing demands based on areas of the URL.

To provide you with an introduction to my setup, I've the HAProxy machine and also the two backends:

  • IIS website (primary site)
  • Wordpress blog on NGINX (a subsite)

The utilization-situation:

I am looking to route demands with respect to the URL:

  • world wide web.website.com/lang/index.aspx -> primary site
  • world wide web.website.com/lang/blog/articlexx -> blog subsite

Your blog access URL is "/server/blog/lang/articlexx" so I must rewrite the initial client request to that particular format--that is essentially switching "blog" and "lang".

From the way i understood the configuration documentation plus some posts around the internet, I possibly could use reqrep/reqirep to alter the request HTTP headers before it will get passed to some after sales. And when you heard right, than the configuration should work:

frontend vFrontLiner
    bind            x.x.x.x:x
    mode            http
    option          httpclose
    default_backend iis_website

    # the switch: x/lang/blog -? x/blog/lang
    reqirep ^/(.*)/(blog)/(.*) /if\2/\1/\3

    acl blog path_beg -i /lang/blog/

    use_backend blog_website if blog


backend blog_website
    mode    http
    option  httpclose
    cookie  xxblogxx insert indirect nocache
    server  BLOG1 x.x.x.x:80 cookie s1 check inter 5s rise 2 fall 3
    server  BLOG2 x.x.x.x:80 cookie s2 check inter 5s rise 2 fall 3 backup

The issue: The demands being received through the blog_website after sales remains the original URL "x/lang/blog".

I would have skipped something around the regex part but my primary problem is whether my understanding correct or otherwise to make use of the reqirep to begin with. I'd appreciate any help.

Thanks greatly.

Your regex is wrong, you are presuming the server is incorporated in the request path. To complement the request pathways within the headers make use of a regex like that one:

reqrep ^([^\ ]*)\ /lang/blog/(.*) \1\ /blog/lang/\2

you should use reqirep too but that's only helpful in case your servers really serve /BLog/lAnG/ too.