dasisderblyme
dasisderblyme

Reputation: 1184

Google Cloud load balancer routing roles not working

enter image description here

I have two backend services(X backend service and Y backend service) for which I have configured a load balancer and created some routing rules as can be seen in the photo. My goal:

Actual result:

From what I can see only the last route seems to get matched (the one with /* as a path). Not sure what am I missing here.

Upvotes: 1

Views: 983

Answers (1)

dasisderblyme
dasisderblyme

Reputation: 1184

So it turns out I needed to specify the action and url rewrite for the above routes to work. But since there is no option to specify those from the UI I needed to select the advanced route configuration and need to provide it as YAML as the following:

defaultService: projects/some-project/global/backendServices/x-api-dev-backend-service
name: path-matcher-1
pathRules:
- paths:
  - /shopify/*
  service: projects/some-project/global/backendServices/y-dev-backend-service
  routeAction:
    urlRewrite:
      pathPrefixRewrite: /
- paths:
  - /api/*
  service: projects/some-project/global/backendServices/x-dev-backend-service
  routeAction:
    urlRewrite:
      pathPrefixRewrite: /

Upvotes: 2

Related Questions