Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prerender not working on https with Nginx

I am having trouble including prerender in my application running on Nginx, I have defined a simple rule for rewriting all http requests to https , however prerender has some trouble with https running on a GoDaddy certificate , it caches the page but the content is blank. I have tested it on http and it works fine , what I'm trying now is that if my http_user_agent is Prerender I want to keep the http url intact and otherwise rewrite the url to https.

Any help/comments/suggestions are welcome.

like image 425
Sameer Avatar asked May 26 '14 05:05

Sameer


1 Answers

Just had the same issue with prerender handling https redirects. In our case the quick solution was to force https protocol in prerender-node configuration (I assume such option should exist for any other middleware).

var prerender = require('prerender-node');
prerender.protocol = 'https';

But after all it seems to be caused by nginx misconfiguration, which does not pass x-forwarded-proto header, because otherwise it should be automatically handled by the middleware https://github.com/prerender/prerender-node/blob/master/index.js#L235-L237

like image 148
Yura Fedoriv Avatar answered Nov 15 '22 00:11

Yura Fedoriv