0

Let's say I have a single domain fooapi.com and two versions of the API: v1 and v2. How do I configure HAProxy in the marathon.json file so that both API versions can live behind the same domain but with a different path? Eg. fooapi.com/v1/ and fooapi.com/v2/.

The following configuration doesn't work (latest DCOS):

"labels": {
"HAPROXY_0_VHOST": "fooapi.com",
"HAPROXY_DEPLOYMENT_GROUP": "api-grp",
"HAPROXY_GROUP": "external",
"HAPROXY_0_PATH": "/v1"
}
Răzvan
  • 981
  • 9
  • 20

1 Answers1

2

After reading through the Marathon-lb docs, I've solved it by adding the HAPROXY_0_HTTP_BACKEND_PROXYPASS_PATH config parameter:

"labels": {
"HAPROXY_0_VHOST": "fooapi.com",
"HAPROXY_DEPLOYMENT_GROUP": "api-grp",
"HAPROXY_GROUP": "external",
"HAPROXY_0_HTTP_BACKEND_PROXYPASS_PATH": "/v1",
"HAPROXY_0_PATH": "/v1"
}
Răzvan
  • 981
  • 9
  • 20