Cool, I think that first link will work for you. Then you can just ‘redirect’ for the no-keyword case: https://www.haproxy.com/documentation/haproxy-configuration-tutorials/http-redirects/
Remember, SSL/HTTPS does encrypt the URL path, so if the final website requires HTTPS, your proxy will need to have its certificate trusted by your clients
In your HAProxy config (like in this example), it’s checked from top to bottom. So your top-most frontend case should be the one that checks for the special keyword case. Then, if it doesn’t match the keyword, HAProxy will continue going down the list until it finds a frontend that does match. So your second frontend should match for everything, because if it doesn’t find a match, HAProxy shows an error