简体   繁体   中英

Static GCS Website bucket and http root domain not workiing

I created a GCS bucket www.example.com and have setup a CNAME record with my DNS provider (DNSimple) to point at c.storage.googleapis.com . I can now access my domain with www but also want to make the root domain point at the bucket. Reading through threads on the same subject this seems to be possible with a synthetic record (google domains) or ALIAS record (other dns providers). I don't seem to be able to get this to work with DNSimple though so was wondering if anyone can spot my error?

I get the following error when accessing the root domain:

<Error>
<Code>NoSuchBucket</Code>
<Message>The specified bucket does not exist.</Message>
</Error>

I set my ALIAS record to point my root domain example.com at www.example.com but still no luck. So basically the below two records:

ALIAS   example.com www.example.com
CNAME   www.example.com c.storage.googleapis.com

Am I missing something or is this a limitation of DNSimple as this apparently seems to work with Google Domains (after reading through other questions)?

Just to add the bit from the Google documentation which states the same:

Note: DNS does not support creating a CNAME record on a root domain, such as example.com, so in most cases, you must create your CNAME record on a subdomain, such as www.example.com or myblog.example.com. Some DNS providers offer a non-standard feature that allows a root domain to be aliased to another name without the use of CNAME. Consult your DNS provider documentation to determine if such a feature is available.

I am not highly familiar with GCS, as I've used AWS for the same purpose. However, there's a few recommendations:

  1. Make sure to verify the domain
  2. Make sure you have both the www and apex associated to the bucket/configuration. This is often the missing step. www.example.com and example.com are two different hostname, if you point both DNS records to Google but you configure only www.example.com in your Google Account, then the apex won't work (which may be your scenario).

Finally, I recommend you configure the ALIAS to point to the target ( c.storage.googleapis.com ) and not to the www local hostname.

This was simpler than I thought. Instead of adding an ALIAS record I had to add an URL record pointing example.com at http://www.example.com to make the redirect work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM