404 response when calling external web service from amazon ec2 - web-services

When I call an external web service from Amazon EC2 server I get a 404 response for the request. When I call the same web service locally it works fine. Can anyone tell me why this happens?

It is entirely possible that the owner of the service has been seeing too much abuse from Amazon's IP range and that they have blocked access to the API from EC2. Normally however I would expect them to send back an Access Denied rather than a 404 Not Found.

Related

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.

deploy rest api in ec2 and serve through https

I'm new to AWS and I'm in the process of deploying an app there. I already hosted my frontend in S3 and cloudfront and generated a certificate in order to serve my frontend with https. Now I need to provide access to my backend. I already created the proper structure in EC2 and I can even retrieve info from my backend through simple http. The problem is that once my frontend is https and my backend is http it refuses to receive info thowing an error for "mixed content".
I already read a lot of articles from AWS and yet I'm confused on how to implement https in ec2.
I've created load balancers, VPC and etc, but I really can't make it work.
If anyone can help me with , I'd be thankful!

AWS API Gateway with VPC link not stable

I have deployed a API in AWS API gateway with VPC link which connects to a ELB endpoint. There is a EC2 instance behind ELB with Spring MVC and tomcat8. The problem is the API works not very stable. When I test it in both AWS console and Postman, 4 out 10 times, it gives a 404 error. The rest will get the correct response. When I test it using ELB endpoint URL in postman, it works perfect and never throw the 404 error. After some digging, I found out when the 404 error happens, the request even didn't reach ELB, I cannot find any trace in the ELB logs or Cloudwatch. Very appreciate for any help.
HTTP Status 404 – Not FoundType Status ReportDescription The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.Apache Tomcat/8.5.32

Calling external HTTP api from HTTPS django+angular server on AWS

Is this possible?
I am building a ecommerce site that requires calling external api service built on HTTP.
My site is built on AWS EBS, with django(backend) and angular2(frontend).
If I try to call the HTTP api from angular side, mixed-contents errors pops up, which is apparently the chrome browser blocking the call.
Is there a way to do this? I found this answer regarding proxy, but because I'm a newbie, I don't really get how to I can proxy the call with django or angular. Thanks.
Since your application is serving the content over HTTPS, its a must to access other resources also through HTTPS to solve the mixed content issue. The best way to approach is to use a proxy. For that you can either setup a proxy manually using EC2 or using a managed service like AWS CloudFront or AWS API Gateway depending on the nature of the resources you access.
If its a REST API use API Gateway and if its more of content (JS, CSS, HTML and other files & etc.) use CloudFront.

502 error when calling an external web service from azure web service

I have a web service hosted on Azure from which I need to make a request to an external web service. When I try it on localhost it gets an expected response but from Azure I get 502 - Web server received an invalid response while acting as a gateway or proxy server. -- There is a problem with the page you are looking for, and it cannot be displayed. When the Web server (while acting as a gateway or proxy) contacted the upstream content server, it received an invalid response from the content server.
Is this a configuration problem on Azure to allow receipt of incoming responses or is it a problem with the way I am sending requests and receiving responses?
I think the answer to this problem is here: Azure application gateway throws 502 when application sends 401 Looks like any error returned >399 causes Azure to shut down the response and send the 502.