6

I am sending requests to a specific server on a cloud:

wget --header="Host: example.com" http://x.x.x.x:80/
curl -i -H"Host: example.com" http://x.x.x.x:80/

And it returns exactly as expected (a simple static file). However, when I try and access it in a browser, the request times out. I can't imagine it would be a user agent header issue, but then again, I don't really know what else it would be.

It isn't going to a load balancer or anything, should be going directly to the site. Any ideas on why this might be happening? I have my hosts file set to go to that specific IP address.

Thanks

Jonas Schäfer
  • 20,140
  • 5
  • 55
  • 69
Jonathan Reyes
  • 1,387
  • 1
  • 10
  • 23
  • you could try to do further tests by appending more headers and see when it fails. You can get the default headers sent by firefox using running `ncat --listen 8081` in a terminal and simultanously navigating firefox to `http://localhost:8081`. Try to add these on after the other to wget/curl and see what happens. Also try a terminal browser like `w3m` or `links`. Maybe you're also just a victim of bad timing. – Jonas Schäfer Jul 11 '12 at 16:05
  • Dont you have proxy? Check env | grep proxy? Maybe its set only in the browser or only in the terminal? – Gadolin Jul 11 '12 at 16:14

1 Answers1

-1

It looks like you're specifying an IP address in wget/curl but a hostname in your browser. This creates additional variables in the test and we can't troubleshoot the results. (You need to better control the test.)

Try replicating your browser logic on the command line:

wget http://example.com/

This performs the same test as you want in your browser with wget.

If it works, you have a configuration issue with your browser (or perhaps any proxy settings inherited from your OS).

If it does not work, you likely have an issue with your hosts file.

You can also try the test in reverse; find some browser add-on that lets you specify/alter arbitrary headers or that explicitly lets you set the hostname separately from the URL and then go to http://x.x.x.x:80/ as you did with wget/curl.

Adam Katz
  • 14,455
  • 5
  • 68
  • 83