开发者社区> 问答> 正文

windows server + nginx 中文路径报错。? 400 报错

windows server + nginx 中文路径报错。? 400 报错

环境:windows server2008 + nginx

说明:浏览器提交一个请求,经过springMVC处理,转发请求到nginx。如果直接把文件的路径输入到浏览器,不经过springMVC就没问题。

日志:

2017/12/11 11:24:18 [error] 2752#2848: *91 CreateFile() "D:/caishidata/uploadFiles/b934505e-55f9-4117-b2eb-142f2260315f_" failed (2: The system cannot find the file specified), client: 118.116.83.91, server: , request: "GET /caishi-mes-service/file/fileService/b934505e-55f9-4117-b2eb-142f2260315f_%E4%BA%A4%E5%BA%95-%E4%B8%80%E7%A7%8D%E6%BF%80%E5%85%89%E5%A2%9E%E5%87%8F%E6%9D%90%E5%A4%8D%E5%90%88%E5%88%B6%E9%80%A0%E8%A3%85%E5%A4%87.doc HTTP/1.1", upstream: "http://[::1]:8080/caishi-mes-service/file/fileService/b934505e-55f9-4117-b2eb-142f2260315f_%E4%BA%A4%E5%BA%95-%E4%B8%80%E7%A7%8D%E6%BF%80%E5%85%89%E5%A2%9E%E5%87%8F%E6%9D%90%E5%A4%8D%E5%90%88%E5%88%B6%E9%80%A0%E8%A3%85%E5%A4%87.doc", host: "180.168.38.106"

展开
收起
爱吃鱼的程序员 2020-05-30 23:53:26 1263 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    已解决。

    在controller里对转发的URL用utf-8编码。

    response.setHeader("X-Accel-Redirect", URLEncoder.encode(path, "utf-8"));

    2020-05-30 23:53:29
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
CentOS Nginx PHP JAVA 多语言镜像使用手 立即下载
ECS运维指南之Windows系统诊断 立即下载
CentOS Nginx PHP JAVA多语言镜像使用手册 立即下载