简体   繁体   English

使用Javascript安全地查询Solr

[英]Securely Query Solr with Javascript

I have a Solr server setup, working great, and sitting behind an Apache proxy server which limits access to a range of IP's. 我有一个Solr服务器设置,运行良好,位于Apache代理服务器后面,该服务器限制了对IP范围的访问。

To date our application(built in ZF/PHP) would use a PHP proxy function to query the Solr instance.(the ZF server's IP is allowed) however, I've been testing a new interface and have noticed querying Solr directly from JS is light-years faster than using PHP code to proxy things. 到目前为止,我们的应用程序(内置于ZF / PHP中)将使用PHP代理函数来查询Solr实例。(允许ZF服务器的IP),但是,我一直在测试一个新接口,并注意到直接从JS查询Solr是比使用PHP代码代理事物快一光年。

The page I'm testing runs 25+ solr queries per page load. 我正在测试的页面每个页面加载运行25个以上的solr查询。 Using pure JS this loads great, using PHP -not even close to usable. 使用纯JS可以很好地加载,而使用PHP则非常有用。

Is there a way to proxy the client-side using jQuery or something much faster than PHP? 有没有一种方法可以使用jQuery或比PHP更快的代理客户端?

I've been searching for days, reading on various types of proxies, reverse proxies, securely querying webservices without exposing keys, etc.. But I'm still a bit lost as to the best way to query services using JS. 我一直在寻找几天,阅读各种类型的代理,反向代理,在不公开键的情况下安全地查询Web服务等。但是,对于使用JS查询服务的最佳方法,我仍然有些困惑。

Any tutorials or advice would be much appreciated, cheers! 任何教程或建议将不胜感激,加油!

Why don´t you create a requestHandler which is designated to be directly called from the internet and make it accessible? 为什么不创建一个被指定直接从Internet调用并使其可访问的requestHandler呢? (compare solrconfig.xml). (比较solrconfig.xml)。

The Apache-Proxy could be configured to limit access to just this requestHandler (the URL of the requestHandler) and the requestHandler itself can be configured to add an implicit query (should be possible with an invariant fq-parameter). 可以将Apache-Proxy配置为限制仅对此requestHandler(requestHandler的URL)的访问,并且可以将requestHandler本身配置为添加隐式查询(对于不变的fq参数应该是可能的)。

If your update-requestHandler is not accessible it should be okay?! 如果您的update-requestHandler无法访问,应该可以吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM