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.

1

2 Answers 2

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.

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.

2
  • 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
    Commented Jan 25, 2014 at 12:04
  • @Lekensteyn That is correct, it wouldn't work then with cURL. Wasn't thinking about SNI.
    – faker
    Commented Jan 25, 2014 at 12:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .