Restricting Solr with Jetty to localhost
November 11th, 2014 | by admin |If you want to try Apache Solr, the easiest way to get started is to use the example the comes with the download. Just run java -jar start.jar and you can start searching like a pro.
However, the integrated Jetty server is configured to bind to port 8983 on all IP adresses by default. This configuration is unsafe: anyone could clear your whole Solr index!
It is a good idea to let the server listen (bind) only on localhost, unless your server is in a private network. A quick solution is to set the system properties jetty.host and jetty.port on startup, e.g. like that:
1 |
java -Djetty.host=127.0.0.1 -Djetty.port=1337 -jar start.jar |
Alternatively, you can edit the configuration at example/etc/jetty.xml. Look for these lines:
1 2 |
<Set name="host"><SystemProperty name="jetty.host" /></Set> <Set name="port"><SystemProperty name="jetty.port" default="8983"/></Set> |