AWS Route 53 CNAME - amazon-route53

This has to be simple. I have an A record that points to my server just fine. However, I just added a CNAME for a "www".website.com that points to website.com, but it is now just returning an Nginx 404 error. For reference, I'm using Laravel Forge to deploy the server and of course AWS Route 53 for DNS.

I want to post an answer in case anyone comes across this issue like I did. I was unaware that this can be solved by configuring the Nginx config file and through Laravel Forge, it's pretty easy.
On my server, I have 2 sites (one pointing to site.com and one pointing to www.site.com). In my DNS provider (AWS Route 53), I have an A record for each URL and both point to the public IP of my server.
So, I go into the Nginx config (through Laravel Forge) for the site I want to redirect (in this case I want to go from www to non-www) and edit the config file to include the following.
server_name www.site.com;
return 301 $scheme://site.com$request_uri;
Works perfectly now!

Related

AWS Route53 | Alias record from other DNS providers

My client has a domain address on Godaddy and I would like to just connect A record to AWS Api Gateway without changing NS records because my client using other records such as MX and etc on Godaddy and would stay on it.
In Route53 we can create records by alias directly but in this case I'm not sure how could it be possible.
I just did something similar with Amplify and I just imported the domain, changed the CNAME (following the Amplify docs - https://docs.aws.amazon.com/amplify/latest/userguide/to-add-a-custom-domain-managed-by-a-third-party-dns-provider.html).
For API gateway, it might be a little different but I think you can go to Route 53 resolver and look for the inbound query link and then send it to your VPC of your Api Gateway endpoint.
Base on my recent searches on AWS documents and also Evan's document, there is no way without ANAME (Alias Name Record) that must provided by your DNS provider.
I'm not sure that my customer accept migration from existing DNS provider but I'm going to suggest below as our second solution:
example.com couldn't set by ANAME but www.example.com could set CNAME then we can make a simple redirect from example.com to www.example.com.
I think Godaddy providing url redirect by default otherwise we must run an EC2 just for this redirection.
I know it sucks but it seems that there is no any other way.
I will appreciated If someone knows better solution.

Vercel and Pythonanywhere | Deploy separtly frontend and backend on domain and subdomain

I've been working on a project using Django as backend and React as a framework for the frontend. I've deployed this project in Pythonanywhere and it worked fine. Now, I would like to implement Next.js in my project but, unfortunately, Pythonanywhere does not support Node.js. So I decided to deploy my frontend in Vercel and let the backend in Pythonanywhere.
To achieve this, I plan to create a subdomain that handles the API request. In the domain DNS panel, each domain and subdomain respectively will point to different sites. It'd look like this:
www.example.com (Pointing to Vercel, where the React app is hosted)
api.example.com (Pointing to Pythonanywhere, where the backend is hosted)
I've searched about this in Google and it should work. But, here comes my question, is this the best approach or should I consider other options?
Here is a post that is related to this one. In the post, the author plans to deploy both: backend and frontend on GCP.
Thank you in advance for your time and answers!
The setup you described is pretty standard and it will work perfectly. All you need is to take care of the following points:
Make sure "www" and "#" (aka root) points to Vercel's using DNS configuration. It should be an A record to 76.76.21.21 in the root domain and a CNAME record to cname.vercel-dns.com on the "www" subdomain. Remember to redirect the domains for optimal SEO score.
The DNS record for api.example.com should point to the other provider. You need to check if they require an A or CNAME record. They may require additional DNS records (CAA?).
CORS: Notice that example.com should trigger requests to api.example.com. Your CORS configuration should account for that. CORS is a whole different discussion but I will point you in the right direction. You need to check Next.js custom headers and CORS guides.
If you face any issues on Vercel, you can contact their support channel.

Used cloud-flare on a site, but an error occurs (link wrong or retired)

I am trying to point the domain www.xxx.com to www.ttio.com/tc using cloudflare to enable to the https on the site.
On GoDaddy I have changed the nameservers to cloudflare's recommended name servers
I have also gone to "Page rules" on Cloudflare and added a forwarding rule so that the above is in place.
On going to www.xxx.com however, i get the following error:
It redirects to this url: https://shortener.secureserver.net/error_404
and the error is:
Destination
Unknown
Everything's working on our side, so the link you clicked is either wrong or has been retired.
I have done everything I think I should have, so could anyone shed any light on this please?
You can't point a domain (e.g. www.xxx.com) at an URL (e.g. www.ttio.com/tc). A domain needs to be converted to an IP address by the browser.
If the web server for www.ttio.com is set to recognise www.xxx.com and serve the content from the /tc folder under www.ttio.com, just set up a CNAME for www.xxx.com pointing www.ttio.com and it will work.
If the web server for www.ttio.com doesn't know about www.xxx.com at all, you'll need to use a translation proxy. One way of doing that is using a Cloudflare worker to map the www.xxx.com/PATH URL to www.ttio.com/tc/PATH. An example of how to do this is at https://developers.cloudflare.com/workers/tutorials/configure-your-cdn/. You may also need to rewrite the HTML so that links in the pages don't point to www.ttio.com/tc. An example of how to do that is at https://developers.cloudflare.com/workers/reference/apis/html-rewriter/.

Nginx always redirecting http to https

Hiyas, Im trying to redirect my non-www domain to a digitalocean droplet serving localhost:3000. When I type in my http://non-www domain, I get a 302 redirect to the https version of the non-www domain.
Here's the pastebin to my config stuff - http://pastebin.com/89HP07cW
I also added A record to digitalocean domain, to point to ip. And 2 cnames, * points to #, and www points to #. I'm just hacking now, reading through all the solutions and config file seems straight forward, but not working for me.

Stopping the naked domain redirecting to www

i recently migrated my application to AWS and setup a cname for www.domain.com and a redirect for the domain.com to redirect to www.domain.com.
The problem is, an external service was using a path on the naked domain.com (something like domain.com/external/service/) But with the redirect all HTTP POST data is being dropped with the redirect and i cant change the url that the external service is calling.
To fix this, i have setup my naked domain on route53 to point to my elastic load balancer where my app is located. I set up an A record pointed at my elastic load balancer using an alias.
Its been two days now and my naked domain still redirects to www. and therefore the external service is down. Any ideas on what i could do?
I am taking a long shot - there are different possible problems:
You are forwarding naked domain via A record to ELB, but your EC2 instace (say Apache) is still doing a redirect (not DNS, but http 301) back to www.
Check the DNS TTL. If the TTL is too large (say 48 hrs), then it takes that time. You need to wait longer.
Is Route53 fully managing your DNS? One possibility is that, somebody else like Godaddy is still doing the DNS for you - so nobody is contacting Route53 for the change to reflect.