13

Our website mysite.com is going to be hosted at a server with virtual hosting (name-based) at 10.20.30.40. However, the DNS records are currently pointing to 66.77.88.99.

I want to keep those DNS records pointing to 66.77.88.99 while testing; is there any way for me to access 10.20.30.40 anyway?

Since the target server uses virtual hosting, I cannot simply enter the IP address to test on the target site. Also, I have no control over the target server, and can therefore not set up a subdomain to test on.

IQAndreas
  • 1,550
  • 2
  • 20
  • 39
  • Use nc netcat and submit a request manually? Use check_http https://www.monitoring-plugins.org/doc/man/check_http.html – Zoredache Jan 25 '14 at 10:48

2 Answers2

13

As pointed out adding it to /etc/hosts is one option.

I usually use the Modify Headers Firefox Addon.
I don't have to change system configuration and become root everytime I want to test this.

Another way is using cURL like this:

curl -H "Host: mysite.com" http://10.20.30.40

This is especially useful for quick troubleshooting.
And you don't have to remove anything after you are done.

faker
  • 17,496
  • 2
  • 60
  • 70
  • 4
    Instead of setting the Host header (which presumably only works for HTTP, not HTTPS with SNI), you could also use the `--resolv` option: `curl --resolve example.com:80:192.0.2.1 --resolve example.com:443:192.0.2.2 http://example.com/` – Lekensteyn Jan 25 '14 at 12:04
  • @Lekensteyn That is correct, it wouldn't work then with `cURL`. Wasn't thinking about SNI. – faker Jan 25 '14 at 12:41
11

Put the host names with appropriate IP address in your hosts file (/etc/hosts in Linux, %SYSTEMROOT%\System32\Drivers\etc\hosts on Windows systems) like this:

# IP address of your test host     FQDN of your domain
10.20.30.40                        www.mysite.com

Do not forget to remove the entries after testing.

the-wabbit
  • 40,737
  • 13
  • 111
  • 174
Halfgaar
  • 8,084
  • 6
  • 45
  • 86