We are using sunspot-rails to connect to websolr on Heroku. Websolr provides an authorization feature to protect read and update calls. This authorization feature requires three additional http headers to be present in every call to SOLR. I am trying to find out a way to add these http headers to every call going from sunspot. The following article shows how to do it for rsolr but not sunspot - https://github.com/onemorecloud/websolr-demo-advanced-auth. The official heroku doc at https://devcenter.heroku.com/articles/websolr has very little info about authorization. Is there a way to alter http headers through sunspot?
Asked
Active
Viewed 286 times
2 Answers
2
You can customize the connection class used in the Sunspot session. You have see an example in this gist: https://gist.github.com/nz/6243059

polmiro
- 1,966
- 15
- 22
-
1As the founder of websolr, contributor to Sunspot and author of that gist: Yep, exactly right. – Nick Zadrozny Jan 15 '14 at 21:19
1
I had to adapt @polmiro's gist a little bit to make it work: https://gist.github.com/alfonsocora/e1f979621bbfe98e10dc

alf
- 18,372
- 10
- 61
- 92