The HTTP request is not modified by the routing, so a request to http://<host IP>:4041/topic
becomes a request to http://<container 10.42.x.y>:<target port>/topic
. Your service/container probably doesn’t have a /topic
, so it responds 404.
There are options that can make haproxy rewrite the request path to not include the matched prefix that you could set once #1871 is implemented. Rewriting is not enabled by default because it will not work for many applications… anything that responds with root-relative (<img src="/images/blah.jpg"/>
) or absolute URLs (<a href="http://<host header>/things/stuff
) will not include the prefix and will therefore be broken. These are both pretty common, but may not occur in your specific application. Some applications have config options to tell it what root path it should be served under that you could set to /topic
.
But basically this is why people often use subdomains instead of path routing .