Published in blog / webtech

Ok, this one is going to be a fairly short post. But nevertheless very helpful, if you:

  • have issues with your CDN (content delivery network) and don't know if it is your server or the CDN,
  • want to iterate on a page without ongoing cache purging on the site and the CDN,
  • cannot login to your admin panel or

any simlar reason. You may imagine that I have come accross at least one of these reasons. I lost some nerves and so this is little writeup is maybe helpful for you!

What you need is direct access to your server. Only then you can see an un-cached version and make some further troubleshooting.

Then it is necessary to bypass your CDN and access your web server directly using the IP of the website's server.

The solution is quite simple. You need to tell the operating system to contact a certain IP for a certain website.

OK, how do we do that?

Windows: set IP to access a Website

In Windows we need to add the IP and website under:


However, to do so we need to open the file as administrator.

Simply search for your program of choice, i.e. the editor or notepad++ . Then right-click on the result and chose "run as administrator".

Open the file

# Copyright (c) 1993-2009 Microsoft Corp.
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
# For example:
#          # source server
#              # x client host

# localhost name resolution is handled within DNS itself.
#       localhost
#   ::1             localhost

Here, we have to simply add IP and domain.

Let's see how if this works.

A simple verification of the direct IP access to a website

Let's run a test ping to from my location, central Europe. This results in:

Ping is executed for [] with 32 Bytes:
answer by Bytes=32 Time=55ms TTL=116

Please forgive my rough translation of ping's output.

Now let's add the following line to the hosts file:

# localhost name resolution is handled within DNS itself.
#       localhost
#   ::1             localhost

This means we access over the above IP address. Let's see what this does for our ping to the site:

Ping is executed for [] with 32 Bytes:
answer by Bytes=32 Time=184ms TTL=102

The other IP also answers to a request for And it is quite a bit slower - we have accessed a google server in the United States!

Access your website directly, bypass the CDN

To add your website at the actual server's IP, you may simply add the following to your hosts file:

# localhost name resolution is handled within DNS itself.
#       localhost
#   ::1             localhost

That's really easy. We told the operating system to request a certain website from a certain IP. Aren't we quite the hackers? Anyhow, let's find out how this is done in Linux.

Linux: set IP to access a Website

In Linux, we open the hosts file in the following way:

sudo vi /etc/hosts

You may also use another editor such as gedit if you like. However, we need to access this important file as administrator again.

Now add (sounds familiar?!) your cool website accordingly:

That's all. We can really access websites through pre-set IP's from different operating systems.

Let's verify.

Verification of IP access to web server in Linux

The test in Linux is straight forward. We compare the ping to google with and without adaptation of /etc/hosts:

# without adaptation of /etc/hosts
PING ( 56(84) bytes of data.
64 bytes from ( icmp_seq=1 ttl=115 time=41.6 ms

# adding to /etc/hosts
PING ( 56(84) bytes of data.
64 bytes from ( icmp_seq=1 ttl=101 time=129 ms

As you can see, we have effectively changed the IP to access google's website.

Awesome. Anything else?

Notes on Website Security: Make your Website Safe!

We have seen how easy it is to bypass a CDN if you know the IP. If you have a dynamic website such as WordPress or Joomla, make sure that noone can access your admin area without protection.

CDN's such as Cloudflare generally offer very good protection. But if you leave the IP of your actual server in the open, this is an invitation for simple attacking scripts.

Therefore always mask your IP by setting all DNS records using the CDN provider. This includes setting of mail records, which are often forgotten. See for example here for simple explanations.

Additionally, you may set a CDN page rule that noone can actually access your administrator login even with CDN protection.

For a WordPress website on Cloudflare, insert the following page rule:*
Forwarding URL (Status Code: 302 - Temporary Redirect, Url:

Now you may wonder: I cannot access my admin panel! Noone can!

But here comes the trick

Access your website over the server's IP that just you (and your CDN provider) knows. Simply follow the steps above and you (only you) can access your website's admin panel!