HAProxy community

Custom 503 with included image

I have an HAProxy setup that is working correctly for serving a custom 503, except for images and ref-sheets.

inside the .http file i have the following that isn’t loading

> <a class="navbar-brand" href="#"><img class="header-logo" alt="Brand Logo" title="Brand Logo" src="images/standard-logo.png"></a>

src is in -> /errorfiles/images

i have also tried the fully-qualified path, but am met with the same outcome. Is it possible to load images in the error page?

Not if they use the same backend server, because the fact that you are serving a 503 means that the backend server cannot be accessed (for whatever reason), so referencing data on that backend server will not work, because a request of that image will just return the same 503 error and not the actual image.

Either your inline the image (but consider BUFSIZE limits), or reference externally hosted images.

It’s actually described in the documentation:

https://cbonte.github.io/haproxy-dconv/2.0/configuration.html#4.2-errorfile

The files should not exceed the configured buffer size (BUFSIZE), which
generally is 8 or 16 kB, otherwise they will be truncated. It is also wise
not to put any reference to local contents (e.g. images) in order to avoid
loops between the client and HAProxy when all servers are down, causing an
error to be returned instead of an image.

So the content is all local to the haproxy host; the ref is external to the setup.

for srcing a local document to serve for a custom error, what should the content of the path be?

Haproxy is not a webserver, you cannot point to a filesystem.

You either point to remote URL, that doesn’t use the same setup, or you base64 inline it.