Domain Forwarding gives 403 error for AWS and GoDaddy - amazon-web-services

I have a client requirement for whitelabelling, for which I need to forward all requests at hello.example.com to data.value.com.
The url in the browser will show hello.example.com but the page loaded will be of data.value.com.
hello.example.com is hosted on GoDaddy and I have made the corresponding entries in GoDaddy
data.value.com is hosted on AWS with a Cloudfront Distribution.
Now, when I hit hello.example.com I get a 403 error from Cloudfront with the following error Message:
403 ERROR
The request could not be satisfied.
Bad request. We can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.
If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.
Generated by cloudfront (CloudFront)
When I do ping or traceroute on hello.example.com, I am able to see that the ping happens on data.value.com.
What configuration changes do I need to make in order to re-direct my domain requests.

Related

How to resolve the 504 error on AWS Cloudfront EC2 instance

I have the following setup for my website on windows server:
Domain registered in Route 53
EC2 Instance running on windows server
Cloud front to serve the EC2 origin using the distribution with the option to get user redirected from HTTP to HTTPs.
Public certificate deployed on cloud front.
Here is what is working:
The EC2 Origin, every page works on http protocol.
Domain access, correctly redirects user from http to https
The first website page loads without issues.
ISSUE:
The issue is the error 504 which is displayed when any of the link is clicked on the website. Here is the complete error detail:
504 ERROR
The request could not be satisfied.
CloudFront attempted to establish a connection with the origin, but either the attempt failed or the origin closed the connection. We can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.
If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.
Generated by cloudfront (CloudFront)
I have included all the route options to accept http and https.

Cloudfront Error: 502 ERROR The request could not be satisfied

I have an aws lightsail instance. I have already created a distribution and choose the instance as my origin. But when I access the default domain that the distribution gives me: xxxxxxxxxx.cloudfront.net, I got this message:
502 ERROR
The request could not be satisfied.
CloudFront wasn't able to connect to the origin. We can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.
If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.
Generated by cloudfront (CloudFront)
But when I using my domain name to access, it works fine, except some request I got x-cache: Miss from cloudfront
In my distribution, I set up Your distribution pulls content from your origin using HTTPS only.
And in my WordPress's config, I already have my SSL certificate installed and config https like this:
define('WP_SITEURL', 'https://' . $_SERVER['HTTP_HOST'] . '/');
define('WP_HOME', 'https://' . $_SERVER['HTTP_HOST'] . '/');
I don't know if there is anything wrong with my site, can you help me?
I just don't know what wrong with the distribution, certificates built-in AWS Lightsail.
So I go to service AWS Cloudfront and create a distribution with a certificate and config my Lightsail's DNS to this distribution. And everything works fine.
Refer: https://aws.amazon.com/blogs/compute/deploying-a-highly-available-wordpress-site-on-amazon-lightsail-part-1-implementing-a-highly-available-lightsail-database-with-wordpress/

Cloudfront 403 or no response error making request from S3 secured hosted website to ec2 instance maybe secured

My website clap.com is a SPA hosted on an AWS S3 bucket. It is SSL certified.
My ec2 server is hosted on AWS EC2. I think it's SSL certified. I ran through the process to make it SSL certified.
When I make this request ec2-x-xx-xxx-xxx.compute-1.amazonaws.com:3002/getProfile to my EC2 server from my website I get this cloudfront error:
403 ERROR
The request could not be satisfied.
This distribution is not configured to allow the HTTP request method that was used for this request. The distribution supports only cachable requests. We can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.
If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.
When I make a request with https prepended https://ec2-x-xx-xxx-xxx.compute-1.amazonaws.com:3002/getProfile I never get a response back. I don't see any errors in my EC2 server.
I'm not really sure what I'm doing wrong. When I created the certificate for my EC2 server which is using apache, I used clap.com as the CommonName. I also got the CA from ZeroSSL.
Thoughts? This is the worst part about websites.
I've whitelisted the correct IP addresses [edit] and ports [/edit]. I have no problem SSHing into my EC2 server.
I started receiving this error when making a CURL Post request while SSHd into my EC2 Server (Probably most helpful):
(35) error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol
So I thought it was a problem with my Apache Server. So I added Listen 3002 in the httpd.conf file. When I restarted the server I got an error that port 3002 was being occupied. This makes sense since my node server is occupying port 3002. So...
I think I'm misunderstanding how to make my node server hosted on an EC2 SSL certified.
turning off apache I don't get the SSL23_Get_server error anymore and I get the correct response. But, when I make the post request from my website I don't get any responses.

Route53 and Cloudfront The request could not be satisfied?

I just want to serve my s3 files on cdn.mydomain.com
So I create cloudfront distribution which is working fine on https://dxxxxxxxx.cloudfront.net/test.jpg - I get the image.
And now I want to associate my domain at cdn.domain.com with cloudfront in route53.
So I create A record type A-IPv4 address. with name cdn.domain.com alias target I manully put dxxxxxxxx.cloudfront.net.
But when I open the url:
http://cdn.mydomain.com/test.jpg
I get the error:
403 ERROR
The request could not be satisfied.
Bad request. We can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.
If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.
Generated by cloudfront (CloudFront)
What did I miss with my configuration?
I meet this issue some time before. The request blocked by CloudFront.
Please check this list:
CDN domain added in Cloudfront Alternate Domain Names. Once you add CDN domain to Cloudfront, you can select CloudFront endpoint without typing
WAF (if any) does not block your request
Check Http and Https

ACM Cloudfront cloudflare strange problem

I recently use S3 to host a static site. My domain name is managed by Cloudflare and using a dedicated Cloudflare certificate. I don't want to turn on auto redirect http->https on Cloudflare so I have to create a Cloudfront distribution to do that. I know that's some kind of ugly solution because I use 2 CDN at the same time. Here is the description of my problems:
I create a S3 bucket name staging-etheremon.kyber.network
Create a Cloudfront distribution pointing to that bucket, the distribution using Default CloudFront Certificate.
I CNAME the domain name staging-etheremon.kyber.network to that Cloudfront domain. When I try to access using staging-etheremon.kyber.network, Cloudflare shown 526 Invalid SSL Certificate.
Next I open AWS Certificate Manager console and request a public certificate for staging-etheremon.kyber.network using DNS validation. It prompted me to create a CNAME in Cloudflare. I did just that but it still shown me pending validation.
Here is the strange part, after request the cert, my site was working despite the fact that I didn't change the Cloudfront config to import the cert and the certificate request is still PENDING VALIDATION. Also, I tried deleting the request and the site shown 526 error again. I recreate the request and the site was working again. Strange!
I also wait for a few days, I think more than 72 hours and now the request status change from PENDING VALIDATION to VALIDATION TIMED OUT. However, my site is still working, your can check it at staging-etheremon.kyber.network. I also deleted the VALIDATION TIMED OUT request, and the site is working.
I don't know what is the root cause of the problem, but I think it might be some kind of caching, might be on DNS server, CA server or Cloudfront, ...
Thanks in advance!