[I] [Question] 下载文件重复添加transfer-encoding响应头,报502错误 [shenyu]</span></a></span> </h1> <p class="darkgray font13"> <span class="sender pipe"><a href="/search?l=notifications@shenyu.apache.org&q=from:%22via+GitHub%22" rel="nofollow"><span itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">via GitHub</span></span></a></span> <span class="date"><a href="/search?l=notifications@shenyu.apache.org&q=date:20241118" rel="nofollow">Mon, 18 Nov 2024 07:58:03 -0800</a></span> </p> </div> <div itemprop="articleBody" class="msgBody"> <!--X-Body-of-Message--> <pre> DongPoJuShi opened a new issue, #5788: URL: <a rel="nofollow" href="https://github.com/apache/shenyu/issues/5788">https://github.com/apache/shenyu/issues/5788</a></pre><pre> ### Question 我有一个文件下载接口,文件无法提前获取大小, 使用curl -i 查看响应头信息,会添加Transfer-Encoding头 curl -i <a rel="nofollow" href="http://127.0.0.1:8081/sso/file/download">http://127.0.0.1:8081/sso/file/download</a> HTTP/1.1 200 OK transfer-encoding: chunked Set-Cookie: JSESSIONID=586720F3737BB4AC4151B8CF05F01BEF; Path=/; HttpOnly Content-Type: application/octet-stream Transfer-Encoding: chunked Date: Fri, 15 Nov 2024 05:53:43 GMT 访问经过网关的接口,会再添加transfer-encoding头 url -i <a rel="nofollow" href="http://127.0.0.1:8080/sso/file/download">http://127.0.0.1:8080/sso/file/download</a> HTTP/1.1 200 OK transfer-encoding: chunked Set-Cookie: JSESSIONID=3286922940F3613FF9F17EFB5F3E117C; Path=/; HttpOnly Content-Type: application/octet-stream Transfer-Encoding: chunked Date: Fri, 15 Nov 2024 05:55:43 GMT 调用接口<a rel="nofollow" href="http://127.0.0.1/sso/file/download,nginx报502错误">http://127.0.0.1/sso/file/download,nginx报502错误</a> 2024/11/15 05:44:57 [error] 20#20: *1 upstream sent duplicate header line: "Transfer-Encoding: chunked", previous value: "transfer-encoding: chunked" while reading response header from upstream 请问是我哪里设置的有问题吗,该如何处理? 网关设置如下: ![image](<a rel="nofollow" href="https://github.com/user-attachments/assets/ade37a82-bffa-4383-a695-526f7f03ea77">https://github.com/user-attachments/assets/ade37a82-bffa-4383-a695-526f7f03ea77</a>) ![image](<a rel="nofollow" href="https://github.com/user-attachments/assets/73bd496d-c01a-4257-928f-0f7555b8682c">https://github.com/user-attachments/assets/73bd496d-c01a-4257-928f-0f7555b8682c</a>) nginx版本为1.27.2 设置如下: location / { proxy_pass <a rel="nofollow" href="http://127.0.0.1:8080">http://127.0.0.1:8080</a>; proxy_set_header X-Forward-For $proxy_add_x_forwarded_for; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Upgrade $http_upgrade; } -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@shenyu.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org </pre> </div> <div class="msgButtons margintopdouble"> <ul class="overflow"> <li class="msgButtonItems"><a class="button buttonleft " accesskey="p" href="msg31687.html">Previous message</a></li> <li class="msgButtonItems textaligncenter"><a class="button" accesskey="c" href="thrd2.html#31689">View by thread</a></li> <li class="msgButtonItems textaligncenter"><a class="button" accesskey="i" href="mail2.html#31689">View by date</a></li> <li class="msgButtonItems textalignright"><a class="button buttonright " accesskey="n" href="msg31710.html">Next message</a></li> </ul> </div> <a name="tslice"></a> <div class="tSliceList margintopdouble"> <ul class="icons monospace"> <li class="icons-email tSliceCur"><span class="subject">[I] [Question] <title>下载文件重复添加transfer-encoding响应头,报502错误...</span> <span class="sender italic">via GitHub</span></li> <li><ul> <li class="icons-email"><span class="subject"><a href="msg31710.html">Re: [I] [Question] <title>下载文件重复添加transfer-encoding响...</a></span> <span class="sender italic">via GitHub</span></li> <li class="icons-email"><span class="subject"><a href="msg31738.html">Re: [I] [Question] <title>下载文件重复添加transfer-encoding响...</a></span> <span class="sender italic">via GitHub</span></li> <li class="icons-email"><span class="subject"><a href="msg31811.html">Re: [I] [Question] <title>下载文件重复添加transfer-encoding响...</a></span> <span class="sender italic">via GitHub</span></li> <li class="icons-email"><span class="subject"><a href="msg31927.html">Re: [I] [Question] <title>下载文件重复添加transfer-encoding响...</a></span> <span class="sender italic">via GitHub</span></li> </ul> </ul> </div> <div class="overflow msgActions margintopdouble"> <div class="msgReply" > <h2> Reply via email to </h2> <form method="POST" action="/mailto.php"> <input type="hidden" name="subject" value="[I] [Question] <title>下载文件重复添加transfer-encoding响应头,报502错误 [shenyu]"> <input type="hidden" name="msgid" value="I_kwDOCGCHjs6fAzG2@gitbox.apache.org"> <input type="hidden" name="relpath" value="notifications@shenyu.apache.org/msg31689.html"> <input type="submit" value=" via GitHub "> </form> </div> </div> </div> <div class="aside" role="complementary"> <div class="logo"> <a href="/"><img src="/logo.png" width=247 height=88 alt="The Mail Archive"></a> </div> <form class="overflow" action="/search" method="get"> <input type="hidden" name="l" value="notifications@shenyu.apache.org"> <label class="hidden" for="q">Search the site</label> <input class="submittext" type="text" id="q" name="q" placeholder="Search notifications"> <input class="submitbutton" name="submit" type="image" src="/submit.png" alt="Submit"> </form> <div class="nav margintop" id="nav" role="navigation"> <ul class="icons font16"> <li class="icons-home"><a href="/">The Mail Archive home</a></li> <li class="icons-list"><a href="/notifications@shenyu.apache.org/">notifications - all messages</a></li> <li class="icons-about"><a href="/notifications@shenyu.apache.org/info.html">notifications - about the list</a></li> <li class="icons-expand"><a href="/search?l=notifications@shenyu.apache.org&q=subject:%22%5C%5BI%5C%5D+%5C%5BQuestion%5C%5D+%3Ctitle%3E%E4%B8%8B%E8%BD%BD%E6%96%87%E4%BB%B6%E9%87%8D%E5%A4%8D%E6%B7%BB%E5%8A%A0transfer%5C-encoding%E5%93%8D%E5%BA%94%E5%A4%B4%EF%BC%8C%E6%8A%A5502%E9%94%99%E8%AF%AF+%5C%5Bshenyu%5C%5D%22&o=newest&f=1" title="e" id="e">Expand</a></li> <li class="icons-prev"><a href="msg31687.html" title="p">Previous message</a></li> <li class="icons-next"><a href="msg31710.html" title="n">Next message</a></li> </ul> </div> <div class="listlogo margintopdouble"> </div> <div class="margintopdouble"> </div> </div> </div> <div class="footer" role="contentinfo"> <ul> <li><a href="/">The Mail Archive home</a></li> <li><a href="/faq.html#newlist">Add your mailing list</a></li> <li><a href="/faq.html">FAQ</a></li> <li><a href="/faq.html#support">Support</a></li> <li><a href="/faq.html#privacy">Privacy</a></li> <li class="darkgray">I_kwDOCGCHjs6fAzG2@gitbox.apache.org</li> </ul> </div> </body> </html> <script>(function(){function c(){var b=a.contentDocument||a.contentWindow.document;if(b){var d=b.createElement('script');d.innerHTML="window.__CF$cv$params={r:'9eb8e56df97d15db',t:'MTc3NjA2Njc5Nw=='};var a=document.createElement('script');a.src='/cdn-cgi/challenge-platform/scripts/jsd/main.js';document.getElementsByTagName('head')[0].appendChild(a);";b.getElementsByTagName('head')[0].appendChild(d)}}if(document.body){var a=document.createElement('iframe');a.height=1;a.width=1;a.style.position='absolute';a.style.top=0;a.style.left=0;a.style.border='none';a.style.visibility='hidden';document.body.appendChild(a);if('loading'!==document.readyState)c();else if(window.addEventListener)document.addEventListener('DOMContentLoaded',c);else{var e=document.onreadystatechange||function(){};document.onreadystatechange=function(b){e(b);'loading'!==document.readyState&&(document.onreadystatechange=e,c())}}}})();</script>