Reputation: 33
I am setting up one and possibly more VMs and soon also an APP ENGINE instance running on the same load balancer. The VM will run several lightweight middleware programs, each listening to a different port. I wanted the load balancer to direct traffic to the correct backend service using path rules. Here is an example layout of what I want:
load balancer domain = example.app
middleware_1 listens to port 3000
middleware_2 listens to port 4000
So the path mapping will be:
example.app/1 -> vm_port:3000
example.app/2 -> vm_port:4000
so far everything works fine, but the issue lies in the longer paths, I want the rest of the path and the request to be forwarded to the correct port like so:
example.app/1/v1/test -> vm_port:3000/v1/test
example.app/1/v2 -> vm_port:3000/v2
example.app/2/v1/test -> vm_port:4000/v1/test
example.app/2/v1/test2 -> vm_port:4000/v1/test2
this is the part I am unable to set up. the rules only seem to send the request directly to the port without the sub-path or don't recognize the request. If anyone could point me to a relevant guide or explain where my mistake is I would greatly appreciate it.
this is how i setup the rules:
I have also tried using /pclearing/*
and /pclearing/
but nothing I do seems to get the result i want.
Upvotes: 0
Views: 597
Reputation: 1298
Posting Mr @JohnHanley comment as an answer. This concern can be configured using Advance host and path rules. Just an added information it is better to understand the URL rewrites before configuring the Advance host and path rules which is also recommended from the shared link.
Rewrites feature is it reads the incoming URL request and it replaces the host, the path, or both the host and the path, transforming the URL before directing traffic to the backend service.
Full path rewrites are not supported, below is the example which is also indicated in the shared link as an important reminder:
host.name/path1/resource1 to host.name/path2/resource1 (can rewrite) host.name/path1/resource1 to host.name/path1/resource2. (cannot rewrite)
Upvotes: 1