Attempting to access site by IP or using ssh -L gives Server 404

0

I am attempting to access www.fallenlondon.com by its IP address. However, both ebz-2-1147703023.eu-west-1.elb.amazonaws.com and 46.137.175.221 give a Server Error : 404.

I get the same problem if I do ssh -L *:8080:www.fallenlondon.com:80 me@myremotehost and then navigate to localhost:8080 (this works fine for Google and a couple of other random sites I tried).

Could someone please explain what is going on here? A solution would also be much appreciated.

Edit: As per Kyle Jones' answer, apparently this is caused by not including the (desired) domain name info in HTTP host header as needed by the server to disambiguate and give me the result I want.

Is there some way I can make sure that the header contains what I want it to in both use cases?


nslookup:

nslookup www.fallenlondon.com
Server:     127.0.0.1
Address:    127.0.0.1#53

Non-authoritative answer:
www.fallenlondon.com    canonical name = ebz-2-1147703023.eu-west-1.elb.amazonaws.com.
Name:   ebz-2-1147703023.eu-west-1.elb.amazonaws.com
Address: 46.137.175.221

host:

host www.fallenlondon.com
www.fallenlondon.com is an alias for ebz-2-1147703023.eu-west-1.elb.amazonaws.com.
ebz-2-1147703023.eu-west-1.elb.amazonaws.com has address 46.137.175.221

host fallenlondon.com
fallenlondon.com has address 46.137.122.254
fallenlondon.com mail is handled by 30 aspmx3.googlemail.com.
fallenlondon.com mail is handled by 10 aspmx.l.google.com.
fallenlondon.com mail is handled by 20 alt1.aspmx.l.google.com.
fallenlondon.com mail is handled by 20 alt2.aspmx.l.google.com.
fallenlondon.com mail is handled by 30 aspmx2.googlemail.com.

Iskar Jarak

Posted 2012-05-10T03:30:00.020

Reputation: 128

Answers

2

An IP address is not necessarily unique to a specific Web site.

For many years Web providers have been using the HTTP 1.1 Host header to distinguish web sites and serve multiple web sites from a single IP address. Your web browser sends a Host header to the Web server telling it the domain name of the site you requested, and the server responds with the correct page. If you give an IP address only, the server has no way to determine which site (among the possibly many behind the IP address) you want. In this situation some sites return a generic page, and some return an error code to the browser.

I think you will have to add an entry for www.fallenlondon.com to /etc/hosts (or whatever equivalent static host table your system supports) that points to 127.0.0.1. Then you can use www.fallenlondon.com:8080 to reach the local endpoint of your tunnel and a Host header with the correct domain will be sent through the ssh tunnel and on to the AWS server. I tried this here and it worked for me.

Kyle Jones

Posted 2012-05-10T03:30:00.020

Reputation: 5 706

Is there a way to send the host header when using ssh? Or along with the IP, for that matter? (Yes, I guess I am talking about forging the header in some way, at least in the latter case...) – Iskar Jarak – 2012-05-10T04:01:04.240

@Iskar I edited the answer to address that. – Kyle Jones – 2012-05-10T06:09:49.827

I will accept later today once I have a chance to test it myself. Please excuse the paranoia. – Iskar Jarak – 2012-05-10T23:17:23.300