V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
• 请不要在回答技术问题时复制粘贴 AI 生成的内容
licoycn
V2EX  ›  程序员

遇到一个很奇怪的问题~

  •  
  •   licoycn ·
    Licoy · 2018-11-02 16:52:07 +08:00 · 1000 次点击
    这是一个创建于 2495 天前的主题,其中的信息可能已经有所发展或是发生改变。

    前言

    今日和往常一样写了代码部署到服务器上,出现了一个很摸不着头脑的 BUG:

    SpringBoot 打包之后扔到服务器,启动起来再通过 Nginx 反向代理,有一个 API 是文件上传,在 HTTP 协议下上传规定设置的大小内的文件都是正常的,但是在 HTTPS 下,上传超过 500kb 的文件 SpringBoot 就会报出找不到请求资源,相关代码配置如下:

    SpringBoot 相关代码

    public ResponseResult<FileInfoVO> upload(@RequestParam("files") MultipartFile multipartFile) {
    //在这个之前 Springboot 会报出找不到"files"这个请求表单数据
      FileInfoVO fileInfoVO = fileUploadService.upload(multipartFile,uploadConfig.getPath()+"/cover",false);
      return ResponseResult.okHasData(fileInfoVO);
        }
    

    Nginx 相关配置

        ssl_certificate    /etc/letsencrypt/live/domain/fullchain.pem;
        ssl_certificate_key    /etc/letsencrypt/live/domain/privkey.pem;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
        ssl_prefer_server_ciphers on;
        ssl_session_cache shared:SSL:10m;
        ssl_session_timeout 10m;
        location / 
        {
            proxy_pass http://localhost:1010;
            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 REMOTE-HOST $remote_addr;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_set_header X-Forwarded-Port $server_port;
            proxy_set_header X-NginX-Proxy true;
            
            add_header X-Cache $upstream_cache_status;
            
            expires -1;
        }
    

    有没有 V 友遇到过或者有什么比较好的解决方案?

    目前尚无回复
    关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1233 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 17:36 · PVG 01:36 · LAX 10:36 · JFK 13:36
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.