Skip to content

Hotwo get an OpenShift custom HA Proxy router

I’m testing RedHats new version of their PaaS product OpenShift 3.0. I would like to find out, what capabilities are there for using different protocols than http and http+tls, because it was a missing feature in the 2.0 version. OpenShift 3.0 has the concept of routers to direct incoming traffic to the endpoints. Sad but true fact is, there are just two implementations of routers available (HA Proxy andF5 BIG-IP®) and they just support the protocols HTTP, HTTPS (with SNI), WebSockets and TLS with SNI. Nevertheless, there are some fancy HA Proxy configs for other protocols and I want to play with them. First of all I needed to get a custom HA Proxy running. Here is how:


  • Of course you need a working OpenShift Origin installation (I used this Vagrant file)
  • A running Docker registry service (already there in the Vagrant image)


Creating OpenShift custom HA Proxy router Docker image

  1. Create a working directory and cd into it.
  2. Retrieve the custom HA Proxy template like explained here with this command
  3. Create a file named Dockerfile and paste this code into it:
  4. Optional: I created two error files to visibly test my custom router. Create two files error-page-503.html and error-page-502.html and paste this HTML code it

    Then edit the downloaded haproxy-config.template to add the custom error pages to the default section of the config   vi haproxy-config.template

    After this you need to add them to the docker image file system. Change the Docker file like this:
  5. Run command docker build -t localhost:5000/haproxy-custom . to build your docker file. (Should output something like this: “Successfully built 2976535451a7”).
  6. Run command docker push localhost:5000/haproxy-custom to push the docker image in the OpenShift Docker registry. (Should output something like this: “2976535451a7: Image successfully pushed”).


Deploying OpenShift custom HA Proxy router

  1. Removing the old router, if already in place
  2. Deploy the your custom HA Proxy router
  3. Now you can test your OpenShift custom HA Proxy router. If you did Step 4, you can test it in your browser with the IP of your instance and a non-existing URL. Youe should get your custom error page:
    Sample Screenshot for a test if OpenShift custom HA Proxy router works.

Many thanks  to Vaclav Rozsypalek and Ram Ranganathan for their help and support on the mailing list.

Be First to Comment

Leave a Reply

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