Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
    
Use nc netcat and submit a request manually? Use check_http monitoring-plugins.org/doc/man/check_http.html –  Zoredache Jan 25 at 10:48

2 Answers 2

up vote 7 down vote accepted

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.

share|improve this answer

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.

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.