google-app-enginednsapp-engine-flexible

GoDaddy custom domain Mapped to AppEngine (Flex/Node) 404s when using www


I'm trying to use "www" in the domain http://www.nickjonas.nyc and I'm just getting 404 errors from Google's end. When you go to http://nickjonas.nyc, it works just fine.

Here is what my DNS looks like on GoDaddy:

enter image description here

Here is what it looks like in AppEngine settings:

enter image description here

Here is my app.yaml:

runtime: nodejs
env: flex

And here is my app.js:

// [START gae_flex_node_static_files]
'use strict';

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

app.set('view engine', 'pug');

// Use the built-in express middleware for serving static files from './public'
app.use('/static', express.static('public'));

app.get('/', (req, res) => {
  res.render('index');
});

// Start the server
const PORT = process.env.PORT || 8080;
app.listen(PORT, () => {
  console.log(`App listening on port ${PORT}`);
  console.log('Press Ctrl+C to quit.');
});

// [END gae_flex_node_static_files]
module.exports = app;

Solution

  • There are at least 2 possible ways to remove the 404

    1. On Google App Engine Settings page, you will have to map both your naked and www domains to your project id i.e. repeat the steps you executed for what you currently display in your screen shot for the www subdomain. This will mean your pages will essentially be reachable via 2 urls. If you do this, you should tell Google which one to crawl by setting a canonical url. See documentation

    2. Second option is to keep what you currently have but then add domain forwarding in GoDaddy Settings to forward http://www.nickjonas.nyc to http://nickjonas.nyc. This means that if a user enters http://www.nickjonas.nyc in the browser, it would redirect them to http://nickjonas.nyc The advantage of this method is that you don't have the duplicate url issues associated with method 1.