HAProxy community

Haproxy in openshift for redirection

Hello,
we are using RedHat openshift 3.11 and want to configure a custom router as described in https://docs.openshift.com/container-platform/3.11/install_config/router/customized_haproxy_router.html#install-config-router-customized-haproxy
The custom router shall redirect requests from port 9092 in the following manner:
namespace.apps.openshift_domain:9092/service -->
service-namespace.apps.openshift_domain:8080

The route for the target url exists and can be accessed without error through the default router in this manner:
service-namespace>.apps.openshift_domain:80 -->
service-namespace>.apps.openshift_domain:8080

To achieve this custom router behavior, we made changes in the existing haproxy-config.template by replacing the bind port 80 part with port 9092 and added an extra redirect in the backend openshift_default section:

http-request redirect code 301 drop-query location
http://service-namespace.apps.openshift_domain:8080

Changes are visible in the running custom router pod in the haproxy.config file, and oc logs for the custom router has the following output:

  • Checking http://localhost:9092
  • Health check ok : 0 retry attempt(s).
    I0129 16:04:28.963383 1 router.go:481] Router reloaded:
    [WARNING] 028/160428 (164) : parsing [/var/lib/haproxy/conf/haproxy.config:169] : backend ‘be_tcp:default:docker-registry’ : ‘option tcplog’ directive is ignored in backends.

Unfortunately curl is reporting a “connection refused” error when running on another infra node and “Application is not available”, when running on master/infra node, when we try to access namespace.apps.openshift_domain:9092/service
Even, when the log point out port 9092 (similar as the default router for port 80) the redirection does not work at all.
Any ideas, how this can be resolved?