# Haproxy in openshift for redirection

**URL:** <https://discourse.haproxy.org/t/haproxy-in-openshift-for-redirection/4788>\
**Category:** Help!\
**Created:** [January 30, 2020, 7:40am UTC](https://discourse.haproxy.org/t/haproxy-in-openshift-for-redirection/4788 "2020-01-30T07:40:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ulicle](https://avatars.discourse-cdn.com/v4/letter/u/f19dbf/32.png) [@ulicle](https://discourse.haproxy.org/u/ulicle)\
**Post date:** [January 30, 2020, 7:40am UTC](https://discourse.haproxy.org/t/haproxy-in-openshift-for-redirection/4788/1 "2020-01-30T07:40:20Z")

</div>

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](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](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?
