Fixing the Node.js error: “Cannot GET” URL

Sometimes when using Node.js for your application(s) you may receive an error about the app being unable to “GET a URL”.

This is because of how Passenger uses Application URLs in cPanel, which can be fixed by changing where they are set up in either Phusion or NPM config files as needed!

For example, if the Application URL text box is set to ‘webapp’ then the root path for the application is not “/” but is actually “/webapp”.

This behavior differs from most other web environments where /path typically denotes a directory and “index.js” file located within that directory.”
This Knowledgebase article will cover how to resolve this error. How can one fix node js app error message: ‘Cannot GET’ url?

How to fix the error Node.js application error message: “Cannot GET” URL

To fix this error, you need to include the application URL in your routes. The following code sample demonstrates how to do so using popular Express web framework. It assumes that the Application text box in Node.js cPanel is set to webapp:

const express = require('express');
const app = express();

app.get('/webapp/', function(req, res){
res.send("Hello from the root application URL");

app.get('/webapp/test/', function(req, res){
res.send("Hello from the 'test' URL");

app.listen(0, () => console.log('Application is running'));

In this demonstration, two routes are defined: /webapp and /webapp/test. If your domain name is, when you visit or in a web browser the pages load as expected but if you visit any other URL under it gives Cannot GET error message.

We hope this tutorial helps you find the perfect solution. If your like our tutorials, definitely you’ll love our support. All VernalWeb hosting plans include 24/7 support from our amazing inhouse support staff. Check out our Nodejs Hosting plans and have your website migrated today!

  • Was this article Helpful ?
  • yes   no