Removing prefixes for NEG paths in GCP Load Balancer

42 views Asked by At

Consider 3 Cloud Functions:

  • cf1
  • cf2
  • cf3

I have created a LoadBalancer with:

  1. URL mask /functions/<function>
  2. Removing prefix to /

So now, I can run the CloudFunctions as:

Thanks to point 2, the CloudFunction receives following path:

  • cf1 receives /cf1/one/two
  • cf2 receives /cf2/three/four
  • cf3 receives /cf3/five/six

However, the /cf* part is not desired, because it was only used to determine which CloudFunction to launch. Is there a way to remove this so that the functions receive only the paths which are relevant to them?

  • cf1 would receive: /one/two
  • cf2 would receive: /three/four
  • cf3 would receive: /five/six

The very same thing applies to our Cloud Run services where I would like to achieve the same thing.

1

There are 1 answers

0
Doug Stevenson On BEST ANSWER

If you're looking for some sort of switch or configuration for this, it doesn't exist. You're going to have to write code to parse the actual URL path and extract the data you want out of it, ignoring anything you don't find relevant to the rest of the function's behavior.