Having issues with redirects w/ Google Cloud Storage & Fastly

Comments

2 comments

  • Cassandra Dixon

    So my question is: is there a way to make the Google Cloud Storage default file redirects to work with an override host?

    The default behavior for GCS is one hostname to one bucket.

    If you use the option to override with a default hostname and mask different incoming hostnames, to get the behavior you desire configure redirects or rewrites within the Fastly VCL for each path in the index.html.

    Example:

    if( req.url ~ "/$" ) { set req.url = req.url "index.html";

    Otherwise, if the request is a for a directory - the resulting coding list will be displayed (index.html) vs a html page. When a file name is requested, content will be returned from the GCS bucket if it exists otherwise it will return some error.

  • lukebussey

    If you use c.storage.googleapis.com as your origin host then you don't need to do this and also the 404 page setup on your bucket will work.

Please sign in to leave a comment.