What is wrong behind my ALB on AWS that I get a 404 error (random)? - aws-application-load-balancer

I have set an AWS application load balancer to redirect to IIS (ec2).
There will be more ec2 afterwards. For now, for testing purpose, I only redirect to this VM.
I also set an A record on Route53 pointing to the AWS balancer url.
Problem is that some times I reach the target, and sometimes I dont (with 404 error). Random.
For example, I visit:
http://labcac.netcontent.com.ar:8080/assets/css/bootstrap/bootstrap.min.css
It goes well. Once or twice. Third time, I get 404 error page.
Instead, If I use the public IP of IIS (instead of the Route53 record pointing to the ALB) it always works ok.
What am I doing wrong?
Listener

Related

What would cause apache to redirect from a local IP to a remote IP address

Here's a scenario that I can't figure out; I simply can't understand why an slightly oldish webserver (totally inactive/powered-off for 2y) is behaving this way. I MUST be overlooking something quite simple.
Specifically, when i try to access an Apache instance on Centos 7 residing on my local network (192.168.2.XXX), the apache page responds just fine (Testing 1,2,3; Yay). Watching the access logs on this simple request shows up fine. On this same machine, I have four additional paths set up. One for example is a locked down phpMyAdmin that is accessible only from an internal IP. This route works fine, and the databases can be browsed, etc. Yet, for the other route, such as a wordpress installation or a route to a Magento instance, the the request comes up on the access log (no error log entry), and then just sits there. When the request finally times out, the URL in the browser changes to a new ip address (ABC.XXX.YYY.ZZZ), and then terminates any efforts.
Admittedly, the machine WAS originally configured to be outward facing, and my suspicion is that the IP to which the pages revert may have been the public IP last time the machine was alive. the IP is no longer associated with the site, and the domain which was likely setup with that IP address, is also no longer active.
Does anyone have any suggestions as to what I may look at? I have combed the httpd configurations and there is nothing resembling any such redirection address. Could there be some DNS data that needs to be flushed? A network configuration in sysconfig/ that I am overlooking?
It was nothing to do with my apache configuration. Everything was related to the site urls that were embedded inside the wordpress and magento installations. Upon finding and replacing all instances of the site IP address in some configuration tables, I was able to get both applications to respond properly.

How do I stop my domain name maliciously redirecting?

I have set up my website running on Apache2 on an Ubuntu server. I have two domain names from mydomain.com. I linked them up and they work, usually. But, often, when I try to load the domain name , I get redirected to another advertisement site.
When I load my server IP, it always displays the correct site.
Running: “curl myip” gives me the correct HTML.
Running: “curl www.my-domain-name” gives me...
<HTML><FRAMESET><frame src=“searchvity.com/?dn=“my-domain-name”&pid=9PO1MNJ3”><FRAME src=“blank.html”></FRAMESET></HTML>
Which is someone else.
I do not know how this is happening, or what I could do. It has happened for a while, and doesn’t always happen.
I own two domains and they both redirect to the same site.

How can I host my website on an EC2 Server using Apache but host my images on S3 under the same sub domain?

So I have my website hosted on an EC2 server running apache. All works fine and well.
The issue I'm having is that I want my images hosted on S3 (and possibly cached on CloudFront), not on my EC2 server, but want both accessible under the same domain/subdomain.
For example say my website is www.helloworld.com. I want my images to be accessible at www.helloworld.com/images/foobar.png. I want foobar.png to be hosted on S3 and not each one of my EC2 servers though. How can I go about doing this?
Is there and configuration I can do in the AWS console or are there any rewrite rules I can use in Apache? I know I could always just set up a controller that will download the images from S3 and forward them to the user, but this seems wrong to me.
For that you need to put a load-balancer/proxy in front to intercept all requests and dispatch accordingly. That may not be a bad idea anyway (for availability reasons), but a separate host name for images should not be a problem, either (it's not like users will have to see or type those URL).
Using CloudFront, you can have CloudFront receive the initial requests, then based on the path, forward the request to either your EC2 instance or to your S3 bucket.
For example, you could setup the following:
A CloudFront behaviour that upon a path under /images/ would use an S3 origin, and
A default (for everything else) would go to your EC2 instance origin.

Setting the DNS record to bypass Cloudflare seems to not have any immediate effect?

I have set up a domain name to use Cloudflare. I have tested SSL and all seems well. However I have found that it can cause webfonts to not display in IE11. So I tried to "bypass" cloudflare by clicking on the orange cloud for the status of the A and CName record withing Cloudflare\DNS. The orange cloud icon goes grey.
So I have switched from:
Orange Cloud: Records that display an orange cloud icon are accelerated and protected by CloudFlare
To:
Grey Cloud: Records that display a grey cloud icon will bypass CloudFlare, using only CloudFlare DNS
However when I then try to load up www.mydomain.com again in IE I still get "https://", as prefix, which implies that the domain is still not bypassing Cloudflare. I tried again after 10 mins, cleared temporary files and I still get no resolution.
I have now worked out that restarting the IE browser solves this, but I am not sure why. Is this to do with the 301 page redirect that my page rule invokes to "Always use https" for pattern "/*". Is there a way to clear this without closing and restarting the browser?
Linked to the above I found that I could only get "Full" SSL to work to force "HTTPS". "Flexible" SSL still allowed "HTTP" for some reason.
Advice on the above appreciated.
DNS records do have a Time To Live before the they update (I believe this is 299 seconds on domains set-up using CloudFlare full-host DNS), however I do not think this issue is a CloudFlare problem.
A https prefix does not mean a site is using CloudFlare as there could be an SSL on the origin server. Using the command line I would advise you ping the domain to find if it's routing through CloudFlare or not. You can do this by typing:
ping yourdomain.com
If it routes to your IP Address you know it's not on CloudFlare, if it points to an IP on the CloudFlare network then you are routing through CloudFlare (in which case wait for it to propagate, clear your cache, if you still have no luck raise a support ticket with CloudFlare).

Page display with URL Rewrite on Amazon Elastic Load Balancer (URL rewrite works but the page doesn't display)

There is an issue with Page display with URL rewriting when the ELB handles the request. I have been using 2 instances and load balancer automatically processes the request using one of the instances. When I browse using the Public IP of any of the 2 instances independently, the URL rewriting works fine and page is rendered as expected. But, when I browse using the load balanced URL, the URL rewrite works but the page doesn't work and throws 404 error.
FYI, I have been using apache as web server on instance 1 and nginx as web server on instance 2. I think there shouldn't be a problem because of this.
Please suggest.
I could solve the issue. The problem is in the virtual host configuration of one instance with apache wherein the Public IP is specified. When I used the ELB address instead of Public IP, the issue is fixed.