Comments (6)
Sorry about that! Fixed and added some tests. Can you check with v2.0.2 of prerender-node?
from prerender-node.
OK that's fixed the undefined issue but res.body
is empty. Any ideas why that would be?
from prerender-node.
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.
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.
@dottodot Are you still getting issues here? Are you using out hosted service or your local prerender instance?
from prerender-node.
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)
- how can we judge that the bot is not requesting a resource?
- Add msnbot for results with "Fetch as bingbot"
- Ungzipping gzipped response from prerender service produces corrupted unicode strings HOT 1
- Cloudflare caches pre-rendered response HOT 1
- request dependency has been deprecated HOT 2
- Add hacktoberfest topic
- webp is missing in extensionsToIgnore HOT 1
- Circular redirect while page prerendering HOT 1
- Prerender.io's cached html header getting replaced by static header
- Access denied or empty body
- fastify missing middleware
- How to check for X-Prerender:1 using Express middleware
- [Feature Request] May include a bot detection library rather than a self maintained list? HOT 1
- Add new user agents to every known middleware and docs HOT 7
- Request for changelogs HOT 1
- Provide typescript type definitions HOT 2
- Not working under Meteor 2.5.3 HOT 5
- `req.connection.encrypted` is `undefined` in node:14 HOT 1
- Fastify support?
- Could not find a declaration for module "prerender-node" HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prerender-node.