1
votes

In gcp load balancer. I have this rule:

HOST: *

Paths: /test/*

backend: test-server-backend-bucket

test-server-backend-bucket is bind to a cloud storage bucket test-server. But in test-server, there is no test folder, only files. I can't change the paths and create test folder in the test-server due to some limitation.

Hoping to get files in test-server using url like this http://[ip]/test/test1.txt

Is there someway that I can achieve this in GCP?

2

2 Answers

1
votes

I'm not seeing the value of putting Google Cloud Storage (GCS) access behind a load balancer. Rather, I would imagine that if one wanted to access GCS objects as URLs one would point to those directly.

Imagine your company has the domain name example.com. Then you might associate your back-end services which are accessible through load balancers with the address record in DNS which maps:

services.example.com -> Static public IP of load balancer.

Now let us imagine you create a bucket in GCS called mydata.example.com. By adding a CNAME record in DNS (see https://cloud.google.com/storage/docs/request-endpoints) you could then access files in the bucket as:

http://mydata.example.com/test1.txt

This wouldn't go anywhere near a load balancer and can take advantage of GCS distributed data including CDN.

0
votes

The loadbalancer don't allow you to perform URL rewriting.

The DNS and CNAME solution of Kolban is the right one for a minimizing the Storage operation.