(domain+path) map to diffenent (cloud storage + buicket-name)


#1

HI Fastly

we went to map our domain to object storage ,like amazon S3 and other clould storage provider .
I following your official guilde with override host method ,but it can’t meet our demand .
could your provide a method or vcl example for us to meet following demand ?
now we need to map our uri to diffenent to clould provider and buicket name
following is some example for our demand .
original server : s3.amazon.com
s3.softlayer.com
domain name : www.test.com

when user accesss
www.test.com/image/test.io . -> s3.amazon.com/amazon-buicket-name1/test.io
www.test.com/video/test.io . -> s3.softlayer.com/softlayer-buicket-name1/test.io
www.test.com/image_1/test.io . -> s3.amazon.com/amazon-buicket-name2/test.io


#2

the issue has been solved after config following config to vcl
if( req.http.host == “balifoo123.global.ssl.fastly.net” && req.url ~ “^/image” ) {
set req.http.host = “test11500.s3-us-west-2.amazonaws.com”;
set req.url = regsub(req.url, “/image”, “”);
}

if( req.http.host == “balifoo123.global.ssl.fastly.net” && req.url ~ “^/video” ) {
set req.http.host = “test1600.s3.softlayer.com”;
set req.url = regsub(req.url, “/video”, “”);
}