Having issues with redirects w/ Google Cloud Storage & Fastly



  • 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.


    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.

    Comment actions Permalink
  • 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.

    Comment actions Permalink

Please sign in to leave a comment.