Skip to content

Commit 9b0351b

Browse files
committed
properly set content length for no-body requests
1 parent eedff2d commit 9b0351b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/rack/reverse_proxy.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,11 @@ def proxy(env, source_request, matcher)
6363
if target_request.request_body_permitted? && source_request.body
6464
source_request.body.rewind
6565
target_request.body_stream = source_request.body
66-
target_request.content_length = source_request.content_length
67-
target_request.content_type = source_request.content_type if source_request.content_type
6866
end
6967

68+
target_request.content_length = source_request.content_length || 0
69+
target_request.content_type = source_request.content_type if source_request.content_type
70+
7071
# Create a streaming response (the actual network communication is deferred, a.k.a. streamed)
7172
target_response = HttpStreamingResponse.new(target_request, uri.host, uri.port)
7273

0 commit comments

Comments
 (0)