dfischer / meteor-prerenderio

A meteor wrapper for https://prerender.io/
57 stars 9 forks source link

Blank browser, server console outputs message and prerender.io seems to have an error - related? #7

Open nunohvidal opened 9 years ago

nunohvidal commented 9 years ago

I have added prerender.io suport to my website using meteor add dfischer:prerenderio and added my token to the settings file - this seems to be working correctly as I get the token printed to the server console.

I've added both http://www.thisismysite.com and http://www.thisismysite.com/ to the list of Cache Pages in prerender.io website.

But when in my browser I try to go to http://www.thisismysite.com/?_escaped_fragment_= I get a blank page with the following source:

<html>
  <head></head>
  <body>
    <pre style="word-wrap: break-word; white-space: pre-wrap;"></pre>
  </body>
</html>

and this messages gets outputed to server console (everytime I use ?_escaped_fragment_=)

res.send(status, body): Use res.status(status).send(body) instead

Then, when I go to https://prerender.io/crawl-stats this is what I get (notice the undefined where should be http)

Status Code Response Time (sec) URL Time User Agent
504 0.406 s undefined://www.thisismysite.com/ 2 minutes ago Chrome 39.0
504 0.432 s undefined://www.thisismysite.com/ 10 minutes ago Googlebot 2.1

Am I doing something wrong?

dfischer commented 9 years ago

I think the code for meteor prerender itself needs to be updated to use the code you mentioned re res.send - I don't have time until the weekend to investigate. Feel free to fork and try...

datacarl commented 9 years ago

Did you solve it @nunohvidal?

borismacias commented 9 years ago

Is there a fix?

amandasaffer commented 9 years ago

Is there a fix for this yet @dfischer ?

dferber90 commented 8 years ago

This happens because prerender-node is unable to detect the protocol being used.

If your app is only ever using http, and not https then you can copy the package, inline it into your Meteor project's packages folder and change the first line in dfischer.prerenderio.js from

this.prerenderio = Npm.require('prerender-node'); to this.prerenderio = Npm.require('prerender-node').set('protocol', 'http');

This is a very dirty quick fix. I'm currently working on integrating the newer version of prerender-node into this package. If successful, I'll send a PR.

dferber90 commented 8 years ago

I think I was successful. I was able to remove a LOT of code that is no longer necessary. Sending PR in on Monday probably. It should resolve a lot of the open issues. So, everyone, don't use the hack above and simply wait until Monday :)

dferber90 commented 8 years ago

I went with publishing it myself instead, because I wanted to set up CI and follow Meteor's SemVer extension. I ended up rewriting everything. I feel bad about creating yet another package, but I needed it fast.

Upgrading is as simple as replacing this package with the new one. The configuration can be kept.

Check out dferber:prerender. The new package likely also avoids #16, #13, and maybe #9.