Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/file/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
File 如何在nginx+;tomcat反向代理?_File_Nginx_Tomcat_Reverse Proxy_Xlsx - Fatal编程技术网

File 如何在nginx+;tomcat反向代理?

File 如何在nginx+;tomcat反向代理?,file,nginx,tomcat,reverse-proxy,xlsx,File,Nginx,Tomcat,Reverse Proxy,Xlsx,只是tomcat可以工作,但不能与nginx一起工作 在Tomcat环境中,当我使用http://localhost:port请求它时,它工作正常。但是,在nginx反向代理环境中没有错误,文件关闭不起作用 这是映射到url/excel/clientSampleDownload的SpringJava服务代码 //service code public void downloadSampleExcelFileTms(HttpServletRequest request, HttpServletR

只是tomcat可以工作,但不能与nginx一起工作

在Tomcat环境中,当我使用http://localhost:port请求它时,它工作正常。但是,在nginx反向代理环境中没有错误,文件关闭不起作用

这是映射到url/excel/clientSampleDownload的SpringJava服务代码


//service code
public void downloadSampleExcelFileTms(HttpServletRequest request, HttpServletResponse response, Locale locale)throws Exception {
    ...
    SXSSFWorkbook wb = new SXSSFWorkbook();
    response.setHeader("Set-Cookie", "fileDownload=true; path=/");
    response.setHeader("Content-Disposition", String.format("attachment; 
    filename=\""+newString((saveFileName).getBytes("KSC5601"),"8859_1")+".xlsx\""));
    OutputStream outputStream=response.getOutputStream();
    wb.write(outputStream);
    wb.dispose();
    outputStream.close();
    wb.close();

}
这是nginx配置

//default.conf
server {
    listen       80;
    server_name  domain;

    client_max_body_size 2000M;

    location /manageChannel {
        proxy_pass http://localhost:19912;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        proxy_set_header Origin "";
    }

    location /resources/ {
        alias   /var/www/advertise.alancorp.co.kr/static/resources/;
        autoindex off;
        access_log off;
        expires 1M;
    }

    location / {
            proxy_set_header    Host $http_host;
            proxy_set_header    X-Real-IP $remote_addr;
            proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header    X-Forwarded-Proto $scheme;
            proxy_set_header    X-NginX-Proxy true;
            proxy_pass http://localhost:19912;
            proxy_redirect      off;
            charset utf-8;
            # buffer size
            proxy_buffering   on;
            proxy_buffer_size    1024k;
            proxy_buffers        1024   1024k;
            client_body_buffer_size 1024k;
            proxy_busy_buffers_size 1024k;

    }
}

我应该在nginx配置中添加什么

我在这里得到了答案:

我认为问题在于
内容类型
标题

我的nginx版本是
1.1.0
,添加
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx
进入
conf/mime.types
我在这里得到了答案:

我认为问题在于
内容类型
标题

我的nginx版本是
1.1.0
,添加
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx
进入
conf/mime.types