pfSense's HAProxy - check the url if it has a sub domain name / chars

I have a wildcard Cert and need to direct any sub domain name that does not exist to a custom 503 error page and don’t want to use the Frontend’s Error files feature nor its default 503 page. I want my Backend’s to handle all error pages, but on the server side.

I see in the Access Control lists / Table / Expression has Host regex, Path regex, Url parameter contains. Which one can I use to provide me the ability to check if there is a sub name or chars for example a user type in, (asdas, about, help, etc,…).kohanyim.com.

And if so, I’m really rusty on my regex syntax and can you provide examples I can use?

Would very much appreciate it, Thanks!..

No idea about the HAProxy-specific thing as I don’t use it, but I like https://regex101.com/ for tinkering with regular expressions. It’s got nice visual representation of the matches on test strings. On the left hand menu there is also a “Library” tab, maybe something there can help you.

1 Like