碰到一个很诡异的问题,表单若干数据,但是value=“数字”的数据无法提交到服务器。
服务器nginx+tomcat 代理给tomcat处理
诡异的是什么呢, 比如hidden为1无法提交、改为1.0就可以了
有时候name=xxx.bbb value=40 这样的表单值也无法提交上去
采用了struts2
我怀疑是nginx配置的问题,页面提交后数据其实提交给了nginx代理过去的时候应该是被过滤掉了,帮忙解决一下。
nginx.conf:
#user nobody;
worker_processes 2;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
use epoll;
# 每个工作进程允许最大的同时连接数
worker_connections 4000;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
#sendfile on;
#tcp_nopush on;
server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 5M;
#keepalive_timeout 0;
keepalive_timeout 65;
gzip on;
gzip_http_version 1.0;
gzip_min_length 1000;
gzip_buffers 4 8k;
gzip_comp_level 5;
gzip_disable "MSIE [1-6].";
gzip_types text/plain application/x-javascript text/css text/javascript application/xml;
gzip_vary on;
server {
listen 80;
server_name url.com;
rewrite ^ http://www.url.com$request_uri?;
}
server {
listen 80;
server_name www.url.com;
index index.html index.jsp index.htm;
root /home/www/ROOT;
error_page 404 http://www.url.com/404error.html;
error_page 500 502 503 504 http://www.url.com/500error.html;
error_log on;
location ~.*.(jsp|action|do)$ {
index /home/www/ROOT/index.html;
proxy_pass http://localhost:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Via "nginx";
}
#dwr
location ~ /dwr/* {
proxy_pass http://localhost:8080;
}
location ~.*\.(gif|jpg|png|bmp|swf)$ {
expires 24h;
}
location ~.*\.(js|css|html|htm)?$ {
expires 24h;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location ~ /\.ht {
deny all;
}
}
}
配置不当之处请指出
你这个问题应该跟 nginx 无关,不信你试试把nginx去掉,直接访问 tomcat,问题应该还是存在的 。
这个可以看看是否是字符过滤的servlet引起的,一般工程为了解决乱码问题就会加入一个编码过滤!去掉试试
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。