0

我正在尝试在本地设置Prerender.io服务器。我是 Rails + AngularJs 应用程序。

已经提取了 prerender repo 并使用 node.js 启动了服务器。

$ export PORT=3001
$ node server.js
2015-03-13T08:15:48.152Z starting worker thread #0
2015-03-13T08:15:48.159Z starting worker thread #1
2015-03-13T08:15:48.161Z starting worker thread #2
2015-03-13T08:15:48.163Z starting worker thread #3
2015-03-13T08:15:48.506Z starting phantom on port [12301]
2015-03-13T08:15:48.523Z Server running on port 3001
2015-03-13T08:15:48.524Z starting phantom on port [12304]
2015-03-13T08:15:48.526Z starting phantom on port [12303]
2015-03-13T08:15:48.530Z starting phantom on port [12302]
2015-03-13T08:15:48.541Z Server running on port 3001
2015-03-13T08:15:48.548Z Server running on port 3001
2015-03-13T08:15:48.558Z Server running on port 3001
2015-03-13T08:15:51.750Z started phantom
2015-03-13T08:15:51.755Z started phantom
2015-03-13T08:15:51.757Z started phantom
2015-03-13T08:15:51.758Z started phantom
2015-03-13T08:15:56.715Z getting 

如果我点击下面的 URL,我会正确呈现页面。

localhost:3001/http://localhost:3000/register

但是当使用Rails Prerender 中间件时,页面不渲染并且它显示空页面。我正在点击以下网址。

http://localhost:3000/register?_escaped_fragment_=

看来,它正确地击中服务器并响应状态为 200 ,但页面未显示。

在此处输入图像描述

带有转义片段的输出

在此处输入图像描述

任何帮助都会非常显着。如果需要,我可以提供更多详细信息。

使用彪马服务器

在此处输入图像描述

来自 Prerender.io 的回应

在此处输入图像描述

4

1 回答 1

1

您使用的是瘦网络服务器吗?您应该确保您使用的是 Puma 或 Unicorn 等多进程服务器,因为 Rails 会阻止 I/O 等待 Prerender 响应。

于 2015-03-13T18:12:29.667 回答