Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

For testing purposes, is it possible to circumvent DNS and send an HTTP request for a certain domain name to a specific IP address?

For example, let's say you are building a website for example.com on server 1.1.1.1.

Without updating the domain's actual DNS records (e.g. through the registrar or DNS provider) or fiddling with DNS locally (e.g. updating hosts file), how can you test how 1.1.1.1 would respond to an HTTP request for example.com?

share|improve this question
1  
Would running a DNS server on your LAN count as fiddling with DNS Locally ? –  Lawrence Feb 21 at 1:13
    
this is a weird question.. HTTP request for a domain name.. well, HTTP requests are to an IP address, for webpages.. And if you're making an HTTP Request to a domain for a webpage(whatever that means!)-there is such a thing as a hosts header but it is for when one IP holds many domains,to get to that IP in the first place you'd need the IP or domain+translate to IP.The HTTP request is to an IP not to a domain. The situation would be a bit different perhaps, with a proxy server, but requests are still to IPs. So, it's hard to see what your question means or how it makes sense or what you mean. –  barlop Feb 21 at 15:35

3 Answers 3

Yep.

First, you can issue the request by specifying the IP directly, i.e. http://192.168.99.99/web/path.

Second, each HTTP request includes a Host: header that tells the HTTP server what domain it wants to reach. This exists so that multiple domains can live on a single IP. So if you can find a browser extension or other tool that lets you issue a request and specify that manualy, you can do it.

I haven't used it, but some quick searching turned up a Modify Headers Firefox extension you can try.


You might get SSL certificate errors you need to bypass, if your site is HTTPS and you specify an IP for the URL as it won't have a domain name to compare to the certificate.

share|improve this answer
    
The problem with this is if you're wanting to test your application with subdomains, etc. –  kobaltz Feb 21 at 1:48

No.

I'm not familiar with that Chrome extension but using IP addresses instead of the the DNS records that resolve to them is not a reliable means of testing website behavior. For example, the HTTP/1.1 spec introduced the idea of a Host: header, this permitted virtual hosting (multiple sites sharing an IP address, and I would argue a consequent explosion in inexpensive website hosting). My point is that if you use an IP address rather than a FQDN your browser (with exception to Chrome extension and similar) will not be generating the same headers as it would with a published DNS record, so it's not a real test in the real world.

The "typical" way to do this is exactly what you're trying to avoid: hosts files, "split" DNS, etc.

share|improve this answer

There is a Google Chrome extension called DNS Overrider that will allow you to enable a DNS override of a URL on a page. For example, if I had a local html file on my computer that IFRAME'd a url (http://example.com) then I could use this extension to create an alias that points to 1.1.1.1.

However, keep in mind that this will not work in your address bar. It will only work on the URLs within a page. Using the IFRAME element should work.

share|improve this answer

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.