Have static site on Amazon S3 and Cloudfront, how to add sub-domain hosted elsewhere? - heroku

I have a site with a root domain (mysite.com) as a jekyll static page, hosted on Amazon S3 and Cloudfront. I'd like to add a sub-domain such as purchase.mysite.com which would be located on another provider such as Heroku. The intention here is to have a landing page backed with Amazons CDN and the services somewhere else as at that point I don't think the speed is as important. Has anyone else gone this route? How and what was involved with it's implementation? Is there a better way to accomplish the same goal?

This setup is pretty common I'd imagine.
You need to create a subdomain on your DNS using a CNAME record type pointing at the .herokuapp.com address that Heroku will give your application and then add the custom domain to your Heroku application.

Related

Wix Domain Route to AWS Instance

I have a domain at my WIX Account. I have an AWS EC2 Instance. For URL Masking, I approched this URL link: https://www.youtube.com/watch?v=tZh7sqs1YFo.
Therefore, I created a Hosted Zone in AWS Route53 as it says. I added A Record Set and CNAME Record Set. I changed domain Host points to in the Wix to the AWS EC2 Instance Public IP Address.
Wix Domain Host
Then when I wanted to change the Name Servers in the Wix, it said to not editable fields in the Name Servers.
Name Servers are not editable
So domain is working without the www. If I use www, it stays to the user on the WIX site otherwise it forwards to the AWS EC2 Instance site but I want to use www so I changed CName to my WIX Domain CNAME.
WIX CNAME
But www is not working for my AWS EC2 Instance, it stays the old one WIX Site URL and when I try to reach without www, it takes to the user on the AWS EC2 Site.
I want to know whether I am going to right way or if I am wrong please correct me in this problem.
Can you explain the problem you are trying to solve?
If you are trying to obscure web pages and create a proxy model then the best way to accomplish this it to use the wix-router capability.

How to Redirect Route 53 subdomain to subdirectory of your website

I have a domain on Godaddy and using amazon Route 53 hosting. I want to create a subdomain and make it point to a subdirectory in my site. How is it possible?
I Have Tried
Using S3 bucket, but s3 settings say host a static site. My site isn't static so I believe that option won't work
I have added a subdomain on route 53 with the help of this article
How do I create a subdomain for a domain hosted through Route 53?
and then changed my server settings to make new domain point to a subdirectory using this answer
How to point domain name to Amazon EC2 subdirectory. But it didn't work. Web page shows DNS server not found
Any kind of help will be appriciated. Thanks in advance.
DNS resolves a domain name to the IP address of your server. It only resolves the first part of a URL that defines the server -- it is not involved in the remainder of the URL.
For example:
http://example.com/path/index.html
DNS converts example.com into the IP address of the server. The request for /path/index.html is then sent to port 80 of that server.
Therefore, it is not possible to configure Amazon Route 53 (nor any DNS server) to point to a subdomain of your site.
You could, however, configure your web server to recognize requests going to different domain names and serve different content to the user. For example:
http://images.example.com/foo.jpg
DNS will resolve images.example.com to the same IP address, but the web server can notice that the original request was to images.example.com, so it should serve a different set of content, or content from a desired subdirectory. This configuration would be done within your web server. If that's what you'd like to do, please consult your web server documentation or search the web for that topic.
I had the same issue.
The solution was for me to set the load balancer (Application Load Balancer) as target for sub.mydomain.com and then in the load balancer listener rules, add a rule for the subdomain (as host header value) with a redirect.

What is the best solution to use a common domain/subdomain with Jekyll on Heroku and other hosting website?

I just moved my personal website to Octopress from Drupal. I am hosting it on Heroku and I really don't like the herokuapp.com domain. I already have myname.com domain which I am planning to use with Heroku now for my main website.
The problem is I have some other websites hosted on my hosting service which use databases and other stuff. They were being accessed by project1.myname.com, project2.myname.com etc. I don't want to move them and have a similar subdomain naming thing to access them.
How can achieve this?
If I'm understanding you correctly, it should be easy to do this with your DNS settings. Simply point the DNS "A" records for "myname.com" and "www.myname.com" to Heroku and leave "project1.myname.com" and "project2.myname.com" pointing to your existing provider.

Can I host index.html (homepage) on the Rackspace CloudFiles CDN?

I want to make my web app fast, especially the first page load (index.html).
Can I do this by hosting myfastapp.com on Rackspace CloudFiles and then have a subdomain called nodeserver.myfastapp.com which connects to a Node Server on Joyent.
Note: The node server will only connect via socket.io to tell the client which additional files to grab from the CDN (myfastapp.com).
There's a guide for this in the Cloud Files docs at Create Static Website.
There should be no issue with that the logistics of that.
The main issue is getting the main site on Cloud Files due to cname restrictions, at least in the Rackspace system, but it can probably be done.

Static hosting on S3 can only be done by CNAME from subdomain?

I read this:
"I can't use this until I can serve my root domain without redirection to "www". Can Amazon designate an IP address (or set of IP addresses) for S3 that I can point my root A record to?"
Is it still true that I need to have a domain host just as a proxy to S3 and setup CNAME to point a subdomain to S3 bucket? And there is no better way?
There are no better ways, only most costly ways.
You can set up an EC2 image with a proxy, and allow the proxy to access S3 on your behalf, while accessing the remainder of your web site somewhere else. Since scalability is a concern of yours, you'll also want to use the automatic scaling tools for EC2 as access to your proxy grows.
Or, just re-architect your application to use the CNAME-based approach for all content located in S3.

Resources