Setting up a webpage on google cloud with https - google-cloud-platform

I have bought a domain name on Google Domains, installed Wordpress Multisite on a Google Cloud VM with Compute Engine, setup a load balancer with 2 instances and an Active Google Managed certificate.
I have followed the instructions at https://cloud.google.com/load-balancing/docs/https/ext-https-lb-simple and pointed the Google DNS at the Load Balancer. I currenty get:
The website working in http (not secure) with the direct IP of the VM.
The balancer switching between the two IPs if I enter the https address (ie returning Page served from: lb-backend-pubdeals-x06k) but not returning the wordpress site.
Address is https://pub.deals
But what I want is someone to type in http://pub.deals and https://pub.deals and get the secure site.
Does anyone have instructions on how to redirect users who arrive at http://pub.deals are then redirected to https://pub.deals?
Thanks Jay

So John Hanley was right, I was over complicating things. For the last 20 years or so I've used hosting companies for my sites, and taken care of ssl when I needed to within wp-config and .htaccess, but this is my first time using google cloud and vm builds, so I followed their docs to apply a google managed ssl. They say in order to issue a google managed sll you need to have a load balancer set up, so I rtfm and set one up. It worked as far as the user was delivered to a secure site of either one of two instances, but I couldn't figure out how to attach them to my vm instance with wordpress on it and hence get my content displayed. I did get the http --> https forward using these docs (https://cloud.google.com/load-balancing/docs/https/setting-up-http-https-redirect) but I still didn't manage to connect the whole affair to the VM with wordpress on it.
TLDR; I deleted the load balancers and google certificate and did it through wordpress.

Related

Google Domains to AWS Route53 HTTPS

I have a domain hosted through Google. I'm using Google Workspace for a lot of my day-to-day operations (e.g. Drive, Gmail, etc). I'm using AWS as my infrastructure and business logic for my application. I'm having trouble making my site support TLS. If you visit it now, you get this on chrome and I can't seem to make HTTPS requests work.
I have my domain pointing to AWS via Custom Name Server.
My route 53 has the NS type records listed under the hosted zone
I've tried to request a Certificate from AWS to make it work.
My problem is I don't know how to tell Google about it. How do you let Google know about the certificate so I can make my site HTTPS?
I believe approaching Google is not going to solve your issue as in the above case Google is only responsible to host your domain . So DNS setup is only responsible to route requests to your site and not making your site more secured.
I also found that you are exposing your site as http rather than https and thats why your site is unsecured.
Is your site is running on a web server or is it hosted on S3 as static web site ?
Note: you cant enable https on S3 static website.
The workaround to above problem is below :
Route53 has A record to pointing to ALB (configured with ACM) distributing traffic to Ec2 instances running your web application.
If anyone is still looking. I wanted to keep it cheap with a simple S3 static website. If you want to maintain the S3 part, make a CloudFront distribution (if you haven't already.
Inside the CloudFront under the main settings, use a Certificate you made from Certificate Manager.
Then head over to Route53 (even if the domain is hosted via Google) and route the "A" name record to the CloudFront. NOTE: make sure the "Alternate Domain" name is filled in or else it won't see it.
Let it update for about a minute or two and it will show https

How to setup a Google Cloud load balancer to allow pointing domains with cname records?

I have recently started exploring the Google Cloud Platform Cloud Load Balancer and Cloud CDN products.
I am interested in setting up a load balancer to accept requests from multiple customer-pointed domains and map to an internal service.
Currently, I am creating multiple front-ends for the load balancer which feature a single domain and one or more SSL certificates. This creates a new ephemeral IP address per front-end that customer domains can be pointed to via A records.
Instead, I would like to allow customers to point their domains to my service using CNAME records.
eg. demo.customerdomain.com -> CNAME service.mydomain.com.
Can anyone help me figure out the best way to do this?
I am not sure what benefits/risks this has in terms of security or caching, so if anyone has any input on that, I would be interested to hear it.
Thanks,

Google Domain and AWS S3 Static Page

Good Afternoon,
I have followed a few tutorials on this topic and I have researched to see what I may be missing, but so far I haven't come up with anything. I'm sure it's a simple fix I just need a bit of help.
So I have the domain brandonkjones.dev that I purchased through Google Domains and I am trying to forward it to a static page hosted on S3. I created the hosted zone in Route 52 with the name brandonkjones.dev.
and I changed the Google Domain name servers to match those generated by the hosted zone.
I also added the additional records to forward the subdomain www to the root domain.
and Finally, I added the CNAME entry to the custom resource records on Google.
I'm sure this tutorial left off a step and I'm missing something because the original tutorial didn't even mention adding the CNAM resource within Google. Any help is greatly appreciated.
I had this same issue, tried with multiple browsers and triple checked that I'd done all the Route 53 and Google Domains steps correctly to no avail. Then I opened my terminal and tried:
curl http://my-domain.dev
and it returned my index.html that I uploaded to my S3 bucket, meaning I'd done everything correctly, but my browser wouldn't let me access the website over HTTP. In my devtools network tab, I could see that even if I explicitly typed in http://my-domain.dev it would do a 307 internal redirect to https://my-domain.dev. This is a security feature that browsers have to keep users from navigating to insecure sites over http.
Since the tutorials I followed for setting up S3 static hosting with a custom domain registered on Google Domains did not setup any SSL certificates for enabling HTTPS, the only way I could access my website was over HTTP. One way to fix this issue is to turn off HSTS as outlined here. Or, you could use something like AWS CloudFront to serve your S3 site over https, which you'll probably want to do if you want other people to access your site without this issue.

Connecting Google Domain to Google Cloud Instance

I've recently converted from using traditional registrars and started using Google for website hosting and domain registration. I've followed various guides and am currently infuriated at how hard it is to connect my domain owned by google to the google cloud instance while retaining email forwarding.
In order to point the domain to my VM in requires changing the nameservers. Once the name servers are changed then email forwarding stops working. I'm stuck in an infuriating loop. There has to be a better way.
Here's the process I followed
Google Domain > ExampleSite.com
Google Domain > support#examplesite.com (email forwarding to default gmail account)
Google Cloud > Create Wordpress VM instance
Google Cloud > Add DNS Records
Google Domains > Update Nameservers with info from Google Cloud DNS
Works, but email forwarding is immediately disabled unless I revert to default google nameservers, which stops the domain from pointing to the VM.
Please. Anyone. Help with a better way of doing this. Please. I'm so frustrated.
Thank you.
The reason why email forwarding breaks that your Cloud DNS is not configured with the necessary MX records. Here are the two possible solutions:
Add the MX records described here to your Cloud DNS configuration.
Revert back to Google Domain's name servers, which has the MX records built in. You can then set up your website by creating an A Record for the # record and www subdomain record to point to your GCE's IP address.
If all you want to do is to host a website I recommend (2), as it saves you the cost and complexity of having Cloud DNS as well as Google Domains.

How to point a subdomain to point to a GCP Click to Deploy VM on Google Cloud Platform?

We wanted a subdomain http://magento.ngstorefront.com to point to a VM on Google Cloud. We could not find clear docs on this.
What we did:
Deployed a Magento Google Click to Deploy VM from marketplace
Assigned a Static ip address to the VM --> 35.193.85.53
The default Magento site loads at http://35.193.85.53
To have the sub-domain http://magento.ngstorefront.com load the site (loading at http://35.193.85.53). So we added a new A record for "magento.ngstorefront.com --> 35.193.85.53" in Google Cloud DNS
On the domain registrar (Google Domains), we added a Registered host (magento.ngstorefront.com) and a Custom Record as below.
But the site doesn't load at http://magento.ngstorefront.com What are we missing?
The subdomain is resolving now. Wanted to add the answer.
The mistake we did was to create the subdomain A record in Registrar (Google Domains). Although registered in GoogleDomains, our primary domain ngstorefront.com is pointing to Siteground
So we have to add the A record in Siteground instead of GoogleDomains , like this
Updated on 3/15/2019
While the above solved the issue of IP address pointing and loading Magento, but we had one issue where the URL would change to IP instead of staying as http://magento.ngstorefront.com
To solve the above, do this:
Login to Magento Admin > Stores > Configuration > General > Web > Base URLs
And enter the domain name you want Magento to use.
Based upon the answer provided, I'd say that the problem is, still having set siteground.us as NS.
You'd have to change the NS records to Cloud DNS name-servers at Google Domains, then it would resolve through Cloud DNS and the zone-file can be maintained there (as you've tried without effect).