Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am using the jetty that is shipped with Apache Solr to run Solr. I would like to configure jetty such that it only accepts connections from certain IP addresses. I know I can bind jetty to 127.0.0.1 to only accept connections from the localhost:

<Set name="host"><SystemProperty name="jetty.host" default="127.0.0.1" /></Set>

But how I do set it so that it can accept connections from certain non-localhost IP addresses as well?

share|improve this question
    
    
@Danielt. I don't think that methods works any more, with the new release of jetty –  Saqib Ali Feb 5 '13 at 17:26

2 Answers 2

up vote 2 down vote accepted

You can use the IPAccessHandler that is in jetty 7, 8 and 9

http://download.eclipse.org/jetty/stable-9/apidocs/org/eclipse/jetty/server/handler/IPAccessHandler.html

you would wire this up in the handler chain so that it is executed before anything else in the handler chains

[edit] also look at the jetty-ipaccess.xml file under $jetty.home/etc

http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/tree/jetty-server/src/main/config/etc/jetty-ipaccess.xml

share|improve this answer

You could let iptables or xinetd redirect traffic from port 8080 or 80 to the port you let jetty listen on. Both can restrict to certain IP addresses for this.

Examples can be found here

share|improve this answer
    
can you please give me some examples? I am new to iptables/xinetd. Thanks. –  Saqib Ali Feb 5 '13 at 17:27
    
Have a look at this –  fuero Feb 5 '13 at 17:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.