Configurate Tomcat 8 with GZIP - java

I'm trying to set GZIP in Tomcat, I've shown a lot of examples but anyone works for me. Below you can see my server.xml configuration and an example of request:
server.xml
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"
useSendfile="false"
compression="force" compressionMinSize="1024" noCompressionUserAgents="gozilla, traviata"
compressableMimeType="text/html,text/xml,text/javascript,text/css,application/javascript"/>
request:
Thanks!

I've found the answer, I've disabled my antivirus and compression works fine.

Related

JBoss Configuration - Allowing POST > 10Mb

Hoping somebody can point me in the correct direction here. Currently have a deployed app running on JBoss 4.2.3. The application now has a requirement to allow posts of sizes slightly larger than 10Mb. When the post is that size, it is disallowed on the client side.
I have tried setting the maxPostSize attribute to allow this but that has had no effect. My search through documentation has turned up no other suggestion.
If anybody has any suggestions, they'd be greatly appreciated.
Connector:
<Connector port="443" address="${jboss.bind.address}"
scheme="https" secure="true" SSLEnabled="true" sslProtocol="TLS"
maxThreads="250" maxHttpHeaderSize="16384"
emptySessionPath="true" protocol="HTTP/1.1"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true"
maxSavePostSize = "67108864" maxPostSize = "67108864" />

SSL on Tomcat 7 on Azure VM

I tried to configure SSL certificate for Tomcat 7(7.0.61) which I installed on Azure Windows VM.
Https does not work and there are no errors in Tomcat logs. I use Digicert certificate which gave me .jks keystore file. VM has its own DNS: myVm.cloudapp.net I registered my own domain NNN.today at one.com and make redirection from NNN.today to myVm.cloudapp.net.
When created certificate I used NNN.today. I configured endpoints for my VM (http for port 80 and SSL for port 443). APR listener is commented out in server.xml.
Here is my server.xml config:
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
<Connector port="8443"
maxThreads="150" minSpareThreads="25"
enableLookups="false" disableUploadTimeout="true" acceptCount="100"
scheme="https" secure="true" SSLEnabled="true" clientAuth="false"
sslProtocol="TLS" keyAlias="server"
keystoreFile="${catalina.base}/conf/app_farewell_today.jks" keystorePass="my_password" keystoreType="JKS"
truststoreFile="${catalina.base}/conf/app_farewell_today.jks" truststorePass="my_password" truststoreType="JKS"/>
What am I doing wrong? Any help appreciated!
The VM's firewall should be configured to listen to this ports as well and the public endpoint configuration should map to the proper internal ports as well.

Tomcat 7 and Apache2 connector can't get this working

First of all I put my app in tomcat7 as a ROOT so its like localhost:8080/
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"
URIEncoding="UTF-8"
/>
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true" keystoreFile="/var/lib/tomcat7/conf/allegroTransaction.keystore" keystorePass="spec123ut"
maxThreads="150" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" />
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
Second is my apache2 config:
NameVirtualHost test.domian.com:80
Listen 80
<VirtualHost test.domian.com:80>
ServerName test.domian.com
DocumentRoot "/var/www/elo"
ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / ajp://127.0.0.1:8009/
#ProxyPassReverse / http://127.0.0.1:8080/
</VirtualHost>
And now the problem in error log I see:
[Sun Apr 27 16:24:23 2014] [warn] proxy: No protocol handler was valid
for the URL /. If you are using a DSO version of mod_proxy, make sure
the proxy submodules are included in the configuration using
LoadModule.
But everything look ok any ideas ?
It looks like you are missing the following line in httpd.conf:
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so

SEVERE: error registering connector Tomcat 5.5

I've try to deploy my project with Tomcat 5.5 (sounds dull :D)
But i have a trouble when using SSL with this error like this post.
An error occurred during a connection to localhost:7080.
SSL received a record that exceeded the maximum permissible length.
(Error code: ssl_error_rx_record_too_long)
And later i go and fix it with this post with this post with adding protocol="org.apache.coyote.http11.Http11Protocol" into my Connector tag in my tomcat server.xml. But when i restart my tomcat, there is an error like this image (dont know how to copy this error through windows terminal)
And this is my server.xml connector tag
<Connector port="8443" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" disableUploadTimeout="true"
acceptCount="100" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS"
sslEnabled="true"
keystoreFile="${user.home}/keystores/keystore_lipsweb_jetty.jks"
keystorePass="jetty1" />
<Connector port="7080" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true"
URIEncoding="UTF-8"/>
Well, i still have no idea how to fix this. Really appreciate with your helps. Thanks
i did it like this and it worked for me
<Connector className="org.apache.coyote.tomcat4.CoyoteConnector" port="80" minProcessors="5"
address="10.1.0.50"
maxProcessors="75"
enableLookups="false" redirectPort="443" acceptCount="10" debug="0" connectionTimeout="20000"
useURIValidationHack="false" URIEncoding="UTF-8"/>
<Connector port="443" maxHttpHeaderSize="8192"
address="10.1.0.50"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" disableUploadTimeout="true"
acceptCount="100" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" SSLEnabled="true"
URIEncoding="UTF-8"
keystoreFile="/usr/java/default/jre/lib/security/keystore.jks"
keystorePass="password"/>
I've been resolve this problem by change my Tomcat version. When i create this post, i use Tomcat 5.5.36. But when i try to use an older one (5.5.26), There is no error on deployment and my project working properly.
Well, so far i don't know what the difference between Tomcat 5.5.36 and 5.5.26. I hope in few times i can explain what happen here in detail. But anyone who knows this thing can sharing here and i really appreciate it.

AJP URL encoding

I am having an issue with URL encoding. When I am executing URL on browser, server is encoding it again and again, however the url is already encoded to UTF-8.
eg. http://test.com:80/?gotoUrl=http%3A%2F%2Fclosewindow.xyz.com&modal=true
I am getting - https://test.com/?gotoUrl=http%253A%252F%252Fclosewindow.xyz.com&modal=true
I am running my application on HTTPS and redirecting any request on 80 to HTTPS secure port 443. This problem only occurs if I send request on port 80 and server is redirecting it to secure port 443. If I make request on secure port 443, this problem does not occur.
Following is my tomcat configuration,
<Connector port="8080"
protocol="HTTP/1.1"
connectionTimeout="5000"
compression="on"
compressionMinSize="128"
compressableMimeType="text/html,text/xml,text/plain,text/css,text/javascript,text /json,
application/x-javascript,application/javascript,application/json"
enableLookups="false"
maxPostSize="4096"
URIEncoding="UTF-8"
redirectPort="8443"
/>
<Connector port="8009"
protocol="AJP/1.3"
URIEncoding="UTF-8"
/>
<Connector
protocol="HTTP/1.1"
port="8443" maxThreads="200"
scheme="https" secure="true" SSLEnabled="true"
keystoreFile="/path/keystore" keystorePass="password"
clientAuth="false" sslProtocol="TLS"/>
My environment is like Apache2.2 in on the front and tomcat7.x is connected via AJP with Apache server.
I dig into this issue and I found out that the issue is down to AJP that is using iso-8859-1, however tomcat & Apache are working fine and using UTF-8 encoding. Is there anyway to set encoding to UTF-8 in AJP? I am using mod_proxy_ajp.
Thanks in advance. I would appreciate any help on this.
I suggest the browser is doing it. It doesn't make sense for Tomcat to be doing it. Tomcat would be decoding, not encoding. Try it in the browser with no encoding at all.

Categories

Resources