Dev series: separating landing page from the backbone frontend

We use HAproxy to route requests to desired backends.

We have a backbone frontend and the problem for us has been that because our landing page has been part of the dynamic web application each change to the landing page has required a new software release. Another problem has been that search engines generally don’t love dynamic pages.

We use HAproxy to route requests to desired backends. The desired outcome would be that landing page (and some sub pages) would be served by a static web server and other urls would be served by our NodeJS backend. The problem with our backbone URLs is that they use anchors, e.g. so we cannot do routing using request path. The login view would be seen as the landing page URL by HAProxy.

A solution is to serve the dynamic app from within a subdomain, e.g. and leave the main domain for the landing page.

This can be implemented by the following HAproxy configuration.

Under the frontend block.
Create a rule for the dynamic app:

acl is_webnode hdr_dom(host) -i team

Route dynamic requests to the dynamic backend:

use_backend webnode_http_backend if is_webnode

Serve all other requests from the static backend:

default_backend static_http_backend

Then define backend configuration blocks for the two backends, e.g:

backend static_http_backend
    balance source
    option forwardfor # This sets X-Forwarded-For
    option httpclose
    option httpchk
    timeout queue 100000
    timeout server 100000
    timeout connect 10000
    server apache_http_server localhost:8089 weight 1 maxconn 1024 check inter 10000



Photo by Rowan Heuvel.

Subscribe to our mailing list

* indicates required

Leave a Reply

Your email address will not be published. Required fields are marked *