HAProxy Conundrum

Here is an issue that causes a problem

  1. I have a website and a blog hosted by different companies
  2. For SEO reasons I want the blog hosted at /blog on the main website

Dilemma!

I want a really simple config, something like this in haproxy

 

frontend http
bind *:80
mode http

acl url_blog path_beg /blog
use_backend http-blog-backend if url_blog

default_backend http-website-backend
frontend https
bind *:443
mode tcp
option tcplog

acl url_blog path_beg /blog
use_backend https-blog-backend if url_blog

default_backend https-website-backend

backend http-website-backend
mode http
balance roundrobin
server website servicename.ukwest.cloudapp.azure.com:80 check

backend https-website-backend
mode tcp
balance roundrobin
server website servicename.ukwest.cloudapp.azure.com:443 check

backend http-blog-backend
mode http
balance roundrobin
server blog lb.wordpress.com:80 check

backend https-blog-backend
mode tcp
balance roundrobin
server blog lb.wordpress.com:443 check

 

But the above doesn’t work as the back-end server hosts multiple domains names in a LetsEncrypt Certificate and in mode tcp SSL has not been decrypted so we cannot determine whether /blog is in the URL.

 

Author: Andrew

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.