You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by solr2020 <ps...@gmail.com> on 2018/02/01 12:40:57 UTC

Adding virtual host in Jetty (Solr deployed)

Hi,

We have installed solr which is running in jetty 9x version. We are trying
to change the default solr url to required URL as given below.

Default url: http://localhost:8983/solr

Required URL :http://test.com/solr

To achieve this we are trying to configure virtual host in jetty
(solr-jetty-context.xml) with the below jetty documentation reference
(https://wiki.eclipse.org/Jetty/Howto/Configure_Virtual_Hosts). But it is
not working.




--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html

Re: Adding virtual host in Jetty (Solr deployed)

Posted by solr2020 <ps...@gmail.com>.
We have added virtualHosts block in solr-jetty-context.xml file under
/opt/solr/server/contexts and then restarted solr(jetty). After this while
trying to access solr using the url  http://www.host.com:8983/solr 
it says site can't be reached.
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC &quot;-//Jetty//Configure//EN&quot;
&quot;http://www.eclipse.org/jetty/configure_9_0.dtd&quot;>
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
  <Set name="contextPath"><Property name="hostContext"
default="/solr"/></Set>  
  <Set name="war"><Property name="jetty.base"/>/solr-webapp/webapp</Set>
  <Set name="defaultsDescriptor"><Property
name="jetty.base"/>/etc/webdefault.xml</Set>
  <Set name="extractWAR">false</Set>
    <Set name="virtualHosts">
    <Array type="java.lang.String">
         <Item>10.x.x.x</Item>    
	  <Item>test</Item>	  
	  <Item>www.host.com</Item>	  
    </Array>
  </Set>
</Configure>



--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html

Re: Adding virtual host in Jetty (Solr deployed)

Posted by Charlie Hull <ch...@flax.co.uk>.
On 01/02/2018 12:40, solr2020 wrote:
> Hi,
> 
> We have installed solr which is running in jetty 9x version. We are trying
> to change the default solr url to required URL as given below.
> 
> Default url: http://localhost:8983/solr
> 
> Required URL :http://test.com/solr
> 
> To achieve this we are trying to configure virtual host in jetty
> (solr-jetty-context.xml) with the below jetty documentation reference
> (https://wiki.eclipse.org/Jetty/Howto/Configure_Virtual_Hosts). But it is
> not working.
> 
You're going to need to give more details I'm afraid, such as exactly 
what you expect it to do and what happens when you test it.

Cheers

Charlie
> 
> 
> 
> --
> Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html
> 


-- 
Charlie Hull
Flax - Open Source Enterprise Search

tel/fax: +44 (0)8700 118334
mobile:  +44 (0)7767 825828
web: www.flax.co.uk

Re: Adding virtual host in Jetty (Solr deployed)

Posted by Shawn Heisey <ap...@elyograg.org>.
On 2/1/2018 5:40 AM, solr2020 wrote:
> We have installed solr which is running in jetty 9x version. We are trying
> to change the default solr url to required URL as given below.
> 
> Default url: http://localhost:8983/solr
> 
> Required URL :http://test.com/solr
> 
> To achieve this we are trying to configure virtual host in jetty
> (solr-jetty-context.xml) with the below jetty documentation reference
> (https://wiki.eclipse.org/Jetty/Howto/Configure_Virtual_Hosts). But it is
> not working.

You don't need to configure anything in Jetty to get a hostname to work. 
  Just set up DNS or /etc/hosts properly.  As long as a name lookup 
obtains the correct IP address, Jetty/Solr will respond to it.  No 
verification of the hostname is done.

Getting Solr to answer on port 80 will likely require administrative 
privileges (root on an OS like Linux).  This is an OS requirement, not a 
Jetty requirement.  If it were me, I would set up a load balancer in 
front of Solr to answer on port 80 and forward the requests to whatever 
port Solr is actually running on.

Why do you want to change to port 80?  The most likely reason I can 
imagine is that you're going to put your Solr server on the Internet. 
You should *NOT* do that.  Unless you put some kind of proxy server in 
front of it that can detect and deny attempts to change the index, it's 
going to be a target and attackers are going to make your life very 
difficult.  Even if you prevent public users from changing the index, 
they can still send denial of service queries.

Thanks,
Shawn