tomcat

err_incomplete_chunked_encoding遭遇及修复

星期日, 一月 8th, 2017 | JAVA-and-J2EE | 没有评论

在chrome遭遇 err_incomplete_chunked_encoding 此错误

查看了下 nginx 并没有发现是其的错误

看了tomcat 是 request header is too large 的问题

修复之

1
2
3
4
<Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" maxHttpHeaderSize="65536" maxPostSize="4194304"  
               URIEncoding="UTF-8"/>

搞定

Tags:

踩坑tomcat8.5的cookie机制

星期六, 八月 20th, 2016 | JAVA-and-J2EE | 没有评论

tomcat升级到8.5版本

发现登录和退出报错,报错日志为下

[http-nio-8080-exec-20] 2016 Aug 20 12:04:49 WARN  WARN:187 - Handler execution resulted in exception
java.lang.IllegalArgumentException: An invalid domain [.i5a6.com] was specified for this cookie
        at org.apache.tomcat.util.http.Rfc6265CookieProcessor.validateDomain(Rfc6265CookieProcessor.java:181)
        at org.apache.tomcat.util.http.Rfc6265CookieProcessor.generateHeader(Rfc6265CookieProcessor.java:123)
        at org.apache.catalina.connector.Response.generateCookieString(Response.java:989)
        at org.apache.catalina.connector.Response.addCookie(Response.java:937)
        at org.apache.catalina.connector.ResponseFacade.addCookie(ResponseFacade.java:386)

网上已有哥们查看了tomcat的源码 总结规则如下:

domain规则如下
1、必须是1-9、a-z、A-Z、. 、- (注意是-不是_)这几个字符组成

2、必须是数字或字母开头 (所以以前的cookie的设置为.i5a6.com 的机制要改为 i5a6.com 即可)

3、必须是数字或字母结尾

解决之法: 升级处理cookie的domain的地方即可 由 (.i5a6.com 的机制要改为 i5a6.com )搞定

Tags:

apache,nginx反向代理出现内网ip解决方法

星期四, 二月 23rd, 2012 | JAVA-and-J2EE, linux | 没有评论

apache中设置如下反向代理后端的tomcat出现
request.getServerName();获取到的主机名称就会是localhost,解决这个

<VirtualHost *:80>
    ServerAdmin service@i5a6.com
    DocumentRoot /usr/local/apache/htdocs
    ServerName i5a6.com
    ServerAlias *.i5a6.com
     DirectoryIndex  index.html  index.html.var  index.jsp
     ProxyPass / http://localhost:8080/
     ProxyPassReverse / http://localhost:8080/
     ErrorLog "logs/hscode-error.log"
     CustomLog "logs/hscode-access.log" common
</VirtualHost>

在httpd.conf 文件中增加:
ProxyPreserveHost On 即可

对应的nginx 也有此问题解决之法:
proxy_set_header Host $host;

upstream mytomcat{
 #server 127.0.0.1:8000 weight=3;
 #server 127.0.0.1:8001;
 #server 127.0.0.1:8002;
 server 127.0.0.1:8080;
 }
 
server
{
listen 80;
server_name i5a6.com *.i5a6.com;
index index.html index.htm ;
root /usr/local/data/htdocs/www;
 
location / {
# proxy_set_header Host %host;
# proxy_set_header X-Forwarded-For $remote_addr;
 proxy_pass http://mytomcat;
proxy_set_header Host $host;
 }

Tags: , , , ,

Search

文章分类

Meta