Friday 21 April 2017

prerender.io with express/nodejs error 504 (Gateway Timeout)

I have configured prerender with my angularjs app using nodejs and expressjs middlewear.

To test my configuration is working and and I can see the full html source code, I am trying to access localhost with the url (which is a simple public page which contains angularjs rendering):

 http://localhost:3000/properties/5894a3b51d08f2254243b899?_escaped_fragment_=

I am returned with the 504 (Gateway timeout) error.

In my express configuration I have plugged the prerender script below just before the routing (if execute it anywhere after this it doesn't:

app.use(express.static(path.resolve('./public')));

// Globbing routing files
config.getGlobbedFiles('./app/routes/**/*.js').forEach(function(routePath) {
    require(path.resolve(routePath))(app);
});

//prerender urls for crawlers
app.use(require('prerender-node').set('prerenderToken', 'MY_TOKEN'));

// Catch all route for HTML5 URL mode
var core = require('../app/controllers/core');
app.route('*').get(core.index);

Any suggestions on the cause of this error?



via Sachin Karia

No comments:

Post a Comment