Hi
I am trying to upgrade Solr from v5.3 to v6.1.0 which comes with Jetty 
9.3.8.v20160314.  However, after the upgrade we seem to have lost Gzip 
compression capability since we still have the old configuration.  When I send 
the following request with the appropriate headers, I do not get a gzipped 
response:
curl -H "Accept-Encoding: gzip,deflate" 
"http://localhost:8983/solr/myApiAlias/select?wt=json&q=uuid:%22146c521c-9966-4f0a-94f9-465cd847b921%22&group=true&group.ngroups=true&group.field=uuid&group.limit=10000&sort=start+asc,definition+asc,id+asc&start=0&rows=5";

I should be expecting the "Content-Encoding: gzip" header in the response.  
However, I get the following response:
< HTTP/1.1 200 OK< Content-Type: application/json; charset=UTF-8< 
Content-Length: 393
Here is how the previous configuration was for enabling configuration:
dir:  /opt/solr/server/contexts/solr-jetty-context.xml

--------------------------Solr v5.3 
configuration---------------------------<?xml version="1.0"?><!DOCTYPE 
Configure PUBLIC "-//Jetty//Configure//EN" 
"http://www.eclipse.org/jetty/configure_9_0.dtd";><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><!-- Gzip compression for large content--><Call 
name="addFilter">    <Arg>org.eclipse.jetty.servlets.GzipFilter</Arg>    
<Arg>/*</Arg>    <Arg>        <Call name="of" class="java.util.EnumSet">        
    <Arg><Get name="REQUEST" class="javax.servlet.DispatcherType" /></Arg>      
  </Call>    </Arg>    <Call name="setInitParameter">        
<Arg>mimetypes</Arg>        
<Arg>text/html,text/xml,text/plain,text/css,text/javascript,text/json,application/x-javascript,application/javascript,application/json,application/xml,application/xml+xhtml,image/svg+xml</Arg>
    </Call>    <Call name="setInitParameter">        <Arg>methods</Arg>        
<Arg>GET,POST</Arg>    </Call></Call>
I have modified this configuration to use the GzipHandler 
(http://www.eclipse.org/jetty/documentation/9.3.x/gzip-filter.html) and updated 
solr-jetty-context.xml as follows:
----------------------------Solr v6.1.0 
configuration-----------------------------<?xml version="1.0"?><!DOCTYPE 
Configure PUBLIC "-//Jetty//Configure//EN" 
"http://www.eclipse.org/jetty/configure_9_0.dtd";><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>  <!-- Gzip compression for large content-->  <Set 
name="gzipHandler">    <New 
class="org.eclipse.jetty.server.handler.gzip.GzipHandler">      <Set 
name="includedPaths">        <Array type="String">          <Item>/*</Item>     
   </Array>      </Set>      <Set name="includedMimeTypes">        <Arg>        
  <Array type="String">            <Item>text/html</Item>            
<Item>text/xml</Item>            <Item>text/plain</Item>            
<Item>text/css</Item>            <Item>text/javascript</Item>            
<Item>text/json</Item>            <Item>application/x-javascript</Item>         
   <Item>application/javascript</Item>            <Item>application/json</Item> 
           <Item>application/xml</Item>            
<Item>application/xml+xhtml</Item>            <Item>image/svg+xml</Item>        
  </Array>        </Arg>      </Set>      <Set name="includedMethods">        
<Array type="String">          <Item>GET</Item>          <Item>POST</Item>      
  </Array>      </Set>    </New>  </Set></Configure>
However, when I restart Solr v6.1.0 with the new configuration, it does not 
show any errors in the logs but the application becomes unavailable and all 
requests return 404 Not Found response code.
I have also tried the suggestion posted on Stack Overflow 
(http://stackoverflow.com/questions/30391741/gzip-compression-not-working-in-solr-5-1).
  However, as this is not for Solr v6.1.0, it fails to work as well.
Wondering if someone can please provide a way to configure gzip compression 
with Solr+Jetty installation.  Many thanks.
Kind regards,
Gul

Reply via email to