Test your origin

Complete these steps to test your Linode origin server.

Create test pages

You can use a static or dynamic page to test your Linode origin servers.

  1. To test using dynamic pages, create a page for each of your origin servers. It should show a unique characteristic of the origin servers, such as the server IP address or hostname.

    For example, if you used Node.js Marketplace App to create your Linode, you can edit the /opt/nodejs/hello.js file for each backend Linode and restart Node.js:

const http = require('http');

const hostname = 'localhost';
const port = 3000;

const os = require('os');

//Add the following line:
const servername = os.hostname();

const server = http.createServer((req, res) => {
  res.statusCode = 200;
  res.setHeader('Content-Type', 'text/html');

//Update the following line as shown below:
  res.end('Hello World @'+servername);
});

server.listen(port, hostname, () => {
  console.log();
});
  1. To test using a static page, create a unique html page for each of your Linode origin servers. The pages can simply include text to help you identify each of the origin servers. For example, server1 and server2.
<!DOCTYPE html>
<html>

<head>
   <title>server1</title>
</head>

<body>
   Welcome to server1!
</body>

</html>
<!DOCTYPE html>

<head>
   <title>server2</title>
</head>

<body>
   Welcome to server2!
</body>

</html>

Test session stickiness

  1. Open the test page URL using a web browser that supports HTTP cookies. For example, if you have the Node.js test page above and your website hostname is origin-0361ece-www.test.com, your test page URL is https://origin-0361ece-www.test.com/.

  2. Reload the page a few times. You should receive all responses from the same origin server.

  3. Open a new browser window in private/incognito mode or delete your web browser cookies and test again.

  4. Repeat step 2, until you see a new response coming from a different origin server.

Test failover

  1. To test failover,shut down one of your origin servers by selecting Power Off for the desired Linode.

    Test FailoverTest Failover

  2. Repeat the steps in Test Session Stickiness. You should only get a response from active origin servers.

    For more information on testing options, refer to the Ion documentation.