'Is it possible to host the contents of a Google Cloud Storage Bucket as a 'subfolder' in the url hierarchy of an App Engine Nodejs/Expressjs app?
Essentially, I would like map the url customdomain.com/gcdownload/* to a gc storage bucket so that the download actually comes from the customdomain.com site, rather than from storage.googleapis.com/%bucketname%.
Eg. mapping customdomain.com/gcdownload/a/b/c.pdf to %bucketname%/a/b/c.pdf while still serving c.pdf from customdomain.com.
I did successfully rewrite the download request urls to the storage bucket urls but then the downloads are cross-site requests to the storage.googleapis.com domain so doesn't achieve the goal.
Any way to configure the storage bucket/app engine domain/app code to support serving the static files of a storage bucket as a 'subfolder' of a custom domain?
Solution 1:[1]
I think you can do this if you put a Google Cloud Load Balancer in front of your GAE.
You would first have to setup a GCLB with a serverless NEG for your app engine services:
https://cloud.google.com/load-balancing/docs/negs#serverless-neg
You would then add a backend bucket to your GCS bucket:
https://cloud.google.com/load-balancing/docs/https/ext-load-balancer-backend-buckets
You would then setup the URL map of the GCLB to route /gcdownload/* to your backend bucket and all other traffic to your app engine.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Alex |
