1

I'm pretty sure it's possible, I just don't exactly know how to; but I was wondering how I could view/test my website(s) without changing the DNS?

I'm migrating my websites from provider X (server IP: 159.253.1.196) to provider Y (server IP: 95.85.38.205) and before changing the DNS and I would like to test everything.

I might have done this before, by changing my host file, but I'm not completely sure if that's the right way, or even how do, again.

Since I should be able to access the old server, too, there should be a rather easy way to check the website on the new and old location, in best case simultaneously, but switching from one to another wouldn't be much a problem. The best solution therefor would be to have the new server been shown in Firefox, and the old server is shown in Chrome, but I'm unsure if you can change browser dependently..

Thanks in advance!

1
  • Why not just test the new web site by connecting to the ip address? If you can't do that for some reason then using the hosts file is the way to accomplish it. You won't though, be able to test both sites simultaneously.
    – joeqwerty
    Jun 23 '14 at 19:40
2

You should be able to simply create a hostfile entry as you stated.

WINDOWS: C:\Windows\System32\Drivers\Etc\hosts

95.85.38.205 www.siteurl.com

Once you save that, try to go to the URL in question, and it should be the new side. If you use Chrome or Firefox, you can use an add-on called HTTP Headers, or Firebug respectively. This is about the most basic way to do it.

EDIT: To clarify, the add-on's mentioned above are to show the servers response headers to YOUR HTTP request. They aren't to manipulate the initial request like you would using CURL in Linux. I like to typically set my servers up with response headers that give at least a unique identifier like "PUBLIC-IDENTIFIER" where the value is something like "MY-SERVER-NAME" so that I know which one I'm hitting publicly behind a load balancer. Even without the load balancer, the principal and idea is the same. Ensure you have a way to identify the server you are hitting. How you do this will be dictated by which Server OS and Web Server you are running.

Thanks!

2
  • The host file solution is clear, thank you. However, I'm unsure about the HTTP headers and/or Firebug suggestion. What should I be able to do with them? I know I can inspect element with firebug and such, but can I manipulate DNS or such with it too, so I can see one IP with browser X and an other IP with browser Y? Thanks! Jun 23 '14 at 19:42
  • 1
    Sorry for the lack of clarification. You can't manipulate the header in the request, it shows the servers response headers. As an example, you could insert a response into the header of all requests that list the SERVER-NAME as an example, so that when using a hostfile, you know you are hitting the right server, as it will send the response in the header. This also ensures you aren't looking at a cached variant due to windows DNS caching or Browser caching. I would start with the hostfile, and worry about the add-ons after. Just get to the point where you can quickly switch between server Jun 23 '14 at 19:44
1

these try to solve a similar problem

https://superuser.com/questions/184643/override-dns-in-firefox

https://stackoverflow.com/questions/857376/send-host-header-when-accessing-ip-address-in-firefox

but some of those addons work via the hosts file anyway. you might need the live-http-headers which allows upstream request modification.

I like the dns-via-socks approach, but that needs some setup and a ssh client+account.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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