0
我有我的網站與sorl位於同一臺服務器上。 我希望solr只允許來自我的網站的查詢,而不是來自外部的ips,當然是出於安全原因。 所以後來我的網頁將是唯一一個可以做的查詢,如:繞過使用tomcat從我的網站solr進行基本身份驗證
$.getJSON("http://127.0.0.1:8080/solr/select/?q=*:*&wt=json&json.wrf=?&indent=true", function(result){}
但因爲我有我與身份驗證配置SORL應用它總是提示寫的用戶名和密碼。
<security-constraint>
<web-resource-collection>
<web-resource-name>Solr Lockdown</web-resource-name>
<url-pattern>/</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>solr_admin</role-name>
<role-name>admin</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>Solr</realm-name>
</login-config>
我到過這裏,但這種方法它的阻塞也是我的主要網站,並且仍然提示密碼時,我做的查詢 Tomcat : Bypass basic Authentication for Specified IP Address
那麼它將是一個簡單的解決方案,能夠請求查詢solr只從我的網站? – 2013-05-15 08:57:35
正如我在回答中所述,您需要直接從您的Web應用程序撥打Solr。根據您的Web應用程序執行的語言,可以從中選擇一些Solr客戶端 - http://wiki.apache.org/solr/IntegratingSolr – 2013-05-15 12:01:35
有一些地方我已經使用SolrJ,我的想法是它是通過Ajax完成一些查詢,並以這種方式「保存」我將花費在JVM上的內存,完成所有解析過程等等。 – 2013-05-15 13:04:18