Reputation: 119
I already know that I should use a middleware, but I would like to know how.
I have this source:
const prerender = require('prerender');
var server = prerender({
chromeFlags: ['--no-sandbox', '--headless', '--disable-gpu', '--
remote-debugging-port=9222', '--hide-scrollbars', '--disable-setuid-
sandbox']
});
server.start();
When I go on: http://51.255.193.x:1337/render?url=https://www.google.com/ I don't see it because the files: css and images, they are required directly as: http://51.255.193.x:1337/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png, and this link obtain 400 error (bad request)
How can I fix it ?
Thanks
Upvotes: 0
Views: 733
Reputation: 1604
This is happening because visiting this URL in your browser:
http://51.255.193.x:1337/render?url=https://www.google.com/
Will then cause the browser to load any relative links in the resulting HTML from the domain of http://51.255.193.x:1337/
So like you said, using a middleware so that the HTML is served through your website will fix any issues with relative links.
Upvotes: 1