Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

images 400 bad request #547

Closed
vgflutter opened this issue Oct 22, 2018 · 2 comments
Closed

images 400 bad request #547

vgflutter opened this issue Oct 22, 2018 · 2 comments

Comments

@vgflutter
Copy link

Hi,
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.3:1337/render?url=https://www.tripendipity.com/ I don't see it because the files: css and images, they are required directly as: http://51.255.193.3:1337/assets/frontlogo.png, and this link obtain 400 error (bad request)

How can I fix it ?

Thanks

@arjundas
Copy link

I also facing this issue...
Any solution?

@thoop
Copy link
Contributor

thoop commented Nov 20, 2018

Sorry for the delay here!

Your browser will take any relative links from the HTML that the Prerender server returns and will try to load those relative links from the domain being accessed. Since you are accessing your Prerender server directly, the domain that your browser tries to load those relative links from is your Prerender server....and those files do not live on your Prerender server.

So, setting up the middleware is the correct way to get that working. You could always change your HTML to use absolute links with the full domain name instead of just relative links, but you never want a crawler to access your Prerender server directly. You want the crawlers to access your website and then receive the prerendered page directly from your server so that the crawlers send users to your website directly.

@thoop thoop closed this as completed Nov 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants