You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using Spiderable with Phantomjs and I need the original request object in order to fetch header properties (in my case I need accept-language header). We could achieve this and allow Meteor to use that property by modifying the spiderable_server.js file in this way:
WebApp.connectHandlers.use(function (req, res, next) {
// _escaped_fragment_ comes from Google's AJAX crawling spec:
// https://developers.google.com/webmasters/ajax-crawling/docs/specification
if (/\?.*_escaped_fragment_=/.test(req.url) ||
_.any(Spiderable.userAgentRegExps, function (re) {
return re.test(req.headers['user-agent']); })) {
Spiderable.originalReq = req; // this is the new property
var url = Spiderable._urlForPhantom(Meteor.absoluteUrl(), req.url);
In this way I can use Spiderable.originalReq to read from Meteor the original request headers.
Did that all make sense? :)
Let me know if you want me to submit a pull request.
The text was updated successfully, but these errors were encountered:
I'm using Spiderable with Phantomjs and I need the original request object in order to fetch header properties (in my case I need accept-language header). We could achieve this and allow Meteor to use that property by modifying the spiderable_server.js file in this way:
In this way I can use
Spiderable.originalReq
to read from Meteor the original request headers.Did that all make sense? :)
Let me know if you want me to submit a pull request.
The text was updated successfully, but these errors were encountered: