Using Custom Domains with App Engine
I explore using custom domains with App Engine.
App Engine aplication Creating Google App Engine Project has google asigned appspot.com
subdomain. For example https://argon-retina-346404.uc.r.appspot.com
.
I want to assign the custom domain testapp.raibis.lt
for this application.
Visit App Engine > Settings > Custom Domains > Add Custom Domain.
Click Add Custom Domain
Clicking Verify will redirect to Google Webmaster Central. Here have to select the Other option.
I have to visit Cloudflare and add two DNS records: CNAME testapp
for subdomaintestapp.raibis.lt
and TXT record for site verification.
Come back to Webmaster Central and press Verify button.
Go back to Google Console and click Refresh Domain. Now you should see it like this.
Now I have to come back to Cloudflare and add the listed above A and AAAA DNS records for testapp.raibis.lt
.
You have to delete CNAME first, before adding A and AAAA records.
It can take up to 24h while updated A and AAAA propagate.
I can check domain propogation status with dnschecker.org
testapp.raibis.lt DNS status.
Google certificate generation will fail.
I am using Cloudflare strict encryption mode.
Therefore I have to generate an Origin certificate and add it to App Engine. In Cloudflare raibis.lt > SSL/TLS > Origin Server
Select RSA private key type. Add testapp.raibis.lt
to host names.
Clicking Create will create certificates. I have to upload certificate to App Engine.
Upload a new certificate.
Copy/paste the Public key certificate and Private key. Here starts the fun part. You will get a Private key invalid error.
Fortunately this is easy to fix by renaming private key parts -----BEGIN PRIVATE KEY-----
and -----END PRIVATE KEY-----
to -----BEGIN RSA PRIVATE KEY-----
and -----END RSA PRIVATE KEY-----
Upload and enable certificate.
Now you can visit testapp.raibis.lt
. Be patient you might get 525
error. In this case, you might need to wait sometime.
While waiting you can check if your SSL Certificate is valid.
To view the status of your SSL certificate, you can use an SSL certificate checker tool
Congratulation now you can visit App engine app directly and from testapp.raibis.lt