Google search showing up the Amazon S3 website link - redirect

This is how I set up redirection to the Amazon S3 site:
(Basically followed instructions from here)
Set up a bucket called www.mysite.com and configured it for static website hosting
In my Godaddy account, configured:
Added a CNAME entry for 'www' to point to the publicly accessible S3 site (like mysite.in.s3-website.amazonaws.com)
Added a forwarding rule (302 redirect) to make both mysite.com and www.mysite.com work - whenever someone types in mysite.com, it redirects (browser url bar changes) to www.mysite.com.
Coming to my actual problem - when I do a Google search, the pages are listed under the S3 site ( mysite.in.s3-website.amazonaws.com) - which I'd like to think of as an implementation detail. Is there something else I should do to get google recognize and show links under mysite.com ?

Related

Github pages <> Namecheap, Apex domain to redirect to subdomain

I'm using Github pages for hosting. Namecheap for DNS.
I want if going to "example.com" to send web browser requests to -> "blog.example.com."
I'm able to create and verify a custom domain on github pages for blog.example.com and it works, but not understanding how to redirect the apex root domain to blog.example.com.
Recap:
Custom github pages domain: blog.example.com && Namecheap: CNAME blog => example.github.io.
I tried removing all the suggested github A, AAAA records and trying the use of a URL redirect/301 and also tried an alias record of
"#" -> blog.example.com
URL redirect seems to result in a timeout, and the Alias record seems to result in going to github with a 404.
Seems these are the relevant github pages docs:
https://docs.github.com/en/pages/configuring-a-custom-domain-for-your-github-pages-site/managing-a-custom-domain-for-your-github-pages-site#configuring-a-subdomain
I've looked through this to no avail.
Am I doing something wrong?
Side Question:
I'm unsure if the CNAME file is required in github directory as I feel it's more or less for documentation? (changing this file doesn't seem to have any effect.)
I suppose I was just not being patient, unmasked redirect started working no problem after a while.

Serving static page from GCS with access restrictions

I'm serving a static page on google cloud storage. It works perfectly well, as long as it is public. Now i setted up acl so that only users of one group can read the storage and unauthenticated users get redirected to google authentication. The Problem is now, that the static content of the website, like javascript and css can't be found anymore and i get 404 Errors there. The static content is as well in the storage bucket and it works fine with public urls. When using authenticated urls, it does not work anymore.
Is my attempt of serving an access controlled page right? I guess so, because it works, except for the static content. So do you have any ideas what i am missing here?
Try to deploy on App Engine you file. For this
In the same root directory of your static file, create a app.yaml file with this content
runtime: nodejs10
env: standard
instance_class: F1
handlers:
- url: /
static_files: index.html
require_matching_file: false
upload: index.html
- url: /(.*)
static_files: /\1
require_matching_file: false
upload: /.*
- url: .*
script: auto
Deploy on App Engine gcloud app deploy
Check if it works on the provided URL.
If so:
Go to Security -> Identity Aware Proxy (IAP)
Activate IAP for App Engine; It's possible that the OAuth consent screen have to be configured at this step is you don't do it before
Select the checkbox on the left of your root service, and go the the info panel on the right of the page
Add members, groups or domain with the role IAP-secured Web app user
Test and enjoy!
You can use the following workaround to add user authentication to your GCS static pages based on buckets.
First you need to create a public file called redirect.html this file will be the entry point of your static webpage, and you need to add the following content
<html>
<head>
<meta http-equiv="Refresh" content="0; url=https://storage.cloud.google.com/[yourbucketname]/index.html">
</head>
Redirecting to your site..
index.html and other files must be private files with read permissions granted to selected users
The magic behind this is that your browser will prompt to choose a google account, in case that your browser doesn't have any active google account.
And only the users with Reader permission (or with other roles with read access) will access to your static website.
Just a friendly reminder, this will take the main Google account in the browser if your browser have more than 1 Google account this can cause authentication issues, if this happens use an incognito window.
you can find more information on this Medium article
Extra step
If you have enabled Data access logs this workaround will thrown some authentication issues, you need to add exceptions to the users that will use the authenticated site
To do this, in Cloud Console, navigate to IAM & Admin > Audit Logs. Look through the list or filter for Google Cloud Storage. Click on the row.
In the info panel on the right side, on the Exempted Users tab, click Add Exempted User.

How to host a static website on google cloud storage?

So, I've spent about 5 days searching for an answer here and on Google Docs, including having one of their support people help me. My domain still doesn't resolve to the website.
For the record, the website works if I use the ugly url (http://storage.googleapis.com/7thgradeplay.org/index.html).
I have transferred the domain to google domains, days ago.
I have verified the domain with Google Search Console. Billing is enabled and accruing. Public_html is set on all files and folders.
I am using Google Domains name servers. I am not using Google Cloud DNS.
Per Google support:
Synthetic Records: 302 redirect #.7thegradeplay.org to www.7thgradeplay.org
Custom Resource Records: www CNAME 7thegradeplay.org
Does this matter? storage bucket name is 7thegradeplay.org.
I think that's about all the config I've done.
All of these changes were done on Friday (3 days ago), and I still get a 404 error when I try to go to the website. I have followed the instructions and tried to troubleshoot with these pages:
https://cloud.google.com/dns/troubleshooting
https://cloud.google.com/storage/docs/hosting-static-website
The only thing I varied was the name of the bucket in storage. I used a bucket name without the leading 'www.' Please don't tell me this is all it takes to break it.
All help is appreciated.
P.S. I added a bucket called www.7thegradeplay.org with all the same files. Waited 15 minutes. still 404 error.
P.P.S. I found an answer, but it didn't work: Connect Google domain to Google Cloud Bucket.
I will retry step #5 in the PPS above tomorrow, after the PS change has had time to 'stew'.
Again, any help is appreciated.
Your bucket name needs to match the URL exactly, so if you're visiting www.7thgradeplay.org, the bucket also needs to be named www.7thgradeplay.org.
Similarly, the DNS record for "www.7thgradeplay.org" must be a CNAME to "c.storage.googleapis.com.".
Checking DNS, I see a CNAME from "wwww.7thgradeplay.org" to "7thgradeplay.org". It needs to be "c.storage.googleapis.com." If you've already set that, you may need to wait a while for it to percolate. DNS can be slow to update.
Follow below steps to Host Static Website on Google Cloud Storage.
Creating a CNAME record in DNS :
Go to your respective Domain Service provider account and find DNS
settings and Create a CNAME record that points to
c.storage.googleapis.com.
NAME TYPE DATA
www.example.com CNAME c.storage.googleapis.com
After adding “CNAME” record it will take some time to propagate this
records.
Creating a Cloud Storage Bucket :
Go to Google cloud Console and select Storage from side menu, And
click on Create bucket.
Now create a bucket whose name must matches the CNAME record that
you have created for your domain in DNS settings.
For example, If you added a CNAME record pointing www.example.com
to c.storage.googleapis.com, then create a bucket with the name
www.example.com.
Uploading files to Cloud Storage Bucket :
Now In the list of buckets, click on the name of the bucket that you
have created.
Now create index.html file in your local system for your website
home page.
Now click on Upload files button and select index.html file that
you have created.
Browse the static website :
Now browse your website with your domain name in your web browser.
For example, If your domain name is www.example.com then browse
your website by going to http://www.example.com in your web
browser.
Now, You have successfully hosted your website on Google Cloud
Storage.

Google admin console use with github hosted website

I have purchased a domain through the google admin site (G suite), and I am trying to use it in conjunction with a page hosted on github. In google admin I have added a domain alias that is the url pointing to the github page I have hosted. And through github under the 'Github Pages' section of settings I have changed the custom domain to point to the purchased domain I have. But for some reason the webpage I have in my github repository is not displaying on the domain I have purchased. Instead when I navigate to the domain I have purchased, nothing displays, and when I go to the github url of my hosted page it reroutes me to my purchased url.
Am I doing something wrong?
Here's how I set up http://jsonp.therobinkim.com/ to point to https://therobinkim.github.io/lets-learn-jsonp.
On GitHub, from https://github.com/therobnkim/lets-learn-jsonp settings, I put jsonp.therobinkim.com under my GitHub Pages Custom domain settings.
On Google Domains, from my custom domain's DNS settings, I added a new Custom resource record:
jsonp, my custom subdomain (changed from default #)
CNAME, bc we're pointing to another website by name instead of IP address (changed from default A)
1m (changed from default 1h, but not necessary)
therobinkim.github.io (changed from placeholder IPv4 address)
It started working for me within 5 minutes.
I hope this helps!
You need to create a cname file on your github repository. It is as simple as creating a file called CNAME, then putting your domain on it, i.e. yourdomain.com

Is it possible to use like proxy forward on s3 website?

I'm planning to host s3 website with following DNS.
S3 bucket name: example.com
S3 endpoint: example.com.s3-website.amazonaws.com
I also want to separate manual page for my service:
S3 bucket name: manual
S3 endpoint: manual.s3-website.amazonaws.com
When I enter example.com/manual, it should forward all request to my manual S3 but URL should not be changed.
For example, when I access, http://example.com/manual/en/index.html,
it should show manual.s3-website.amazonaws.com/en/index.html
but the URL should not be changed.
I tried to use redirection rules of 'Static website hosting' of bucket properties, but it just redirects to the my manual page (it changed the url).
And I'm using jekyll, but it doesn't support proxy forward unlike nginx.
Is there anything solution, guide, or example to refer?
It would be possible if you would use CloudFront. You don't have to change your S3-setup.
create an origin for each bucket
create a second Behavior for the manual path
And you're done.