GithubHelp home page GithubHelp logo

Comments (6)

thoop avatar thoop commented on August 21, 2024

Sorry about that! Fixed and added some tests. Can you check with v2.0.2 of prerender-node?

from prerender-node.

dottodot avatar dottodot commented on August 21, 2024

OK that's fixed the undefined issue but res.body is empty. Any ideas why that would be?

from prerender-node.

thoop avatar thoop commented on August 21, 2024

res.body is not empty on mine. Are you sure you're getting a correct response back from whatever server you are accessing? what is that status code on the response? Are there any errors or anything?

from prerender-node.

dottodot avatar dottodot commented on August 21, 2024

OK, so I believe it's because I'm getting a 504 because I was on localhost but I was also see the same problem on my live server due to the url being http://127.0.0.1 as you may have seen on my post else where. There you suggested using prerender.set('host', '127.0.0.1') but that doesn't seem to do anything so I realised maybe need to change that to my domain

so my full code is

    app.use(prerender.set('host', 'stickyblood.co.uk').set('prerenderServiceUrl', 'http://myprerender.com'));
    app.use(prerender.set('beforeRender', function(req, done) {
      var fullUrl = req.protocol + '://stickyblood.co.uk' + req.url;
      console.log(fullUrl)
      client.get(fullUrl, done);
    }));
    app.use(prerender.set('afterRender', function(err, req, res) {
      console.log(res.body);
      var fullUrl = req.protocol + '://stickyblood.co.uk' + req.url;
      client.set(fullUrl, res.body)
    }));

This is now returning a body although it's not rendering the complete page whereas when not using ?escaped_fragment= it renders fine i.e. http://myprerender.com/http://stickyblood.co.uk/about

So now I'm really confused as to where I'm going wrong.

from prerender-node.

thoop avatar thoop commented on August 21, 2024

@dottodot Are you still getting issues here? Are you using out hosted service or your local prerender instance?

from prerender-node.

dottodot avatar dottodot commented on August 21, 2024

Yes sorry forgot to update this I had a trailing slash, so instead of

http://stickyblood.co.uk/about?_escaped_fragment_=

I had

http://stickyblood.co.uk/about/?_escaped_fragment_=

from prerender-node.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.