Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with POSTing big files #884

Closed
dmitriifilonenko opened this issue May 10, 2019 · 5 comments
Closed

Problem with POSTing big files #884

dmitriifilonenko opened this issue May 10, 2019 · 5 comments

Comments

@dmitriifilonenko
Copy link

Currently Ocelot doesn't allow POST requests with big bodies. Effectively it forbids uploading relatively big files.

"Error Code: UnmappableRequestError Message: Error when parsing incoming request, exception: Microsoft.AspNetCore.Server.Kestrel.Core.BadHttpRequestException: Request body too large.
at Microsoft.AspNetCore.Server.Kestrel.Core.BadHttpRequestException.Throw(RequestRejectionReason reason)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.Http1MessageBody.ForContentLength.OnReadStarting()
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.MessageBody.TryInit()
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.MessageBody.CopyToAsync(Stream destination, CancellationToken cancellationToken)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpRequestStream.CopyToAsyncInternal(Stream destination, CancellationToken cancellationToken)
at Ocelot.Request.Mapper.RequestMapper.ToByteArray(Stream stream)
at Ocelot.Request.Mapper.RequestMapper.MapContent(HttpRequest request)
at Ocelot.Request.Mapper.RequestMapper.Map(HttpRequest request) errors found in ResponderMiddleware. Setting error response for request path:/, request method: POST"

This can be worked around on the application level:

WebHost.CreateDefaultBuilder(args)
                .UseKestrel(options =>
                {
                    options.Limits.MaxRequestBodySize = null;
                })

But it would be much better if it was possible on request level, preferebely as a part of ReRoute configuration.

Also it's not completely clear if Ocelot manages to resend request with big content. I face another issue:

"Error making http request, exception: System.Net.Http.HttpRequestException: Error while copying content to a stream. ---> System.IO.IOException: Unable to read data from the transport connection: Broken pipe. ---> System.Net.Sockets.SocketException: Broken pipe
--- End of inner exception stack trace ---
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error)
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
at System.Net.Http.HttpConnection.WriteAsync(ReadOnlyMemory`1 source)
at System.Net.Http.HttpContent.CopyToAsyncCore(ValueTask copyTask)
--- End of inner exception stack trace ---
at System.Net.Http.HttpContent.CopyToAsyncCore(ValueTask copyTask)
at System.Net.Http.HttpConnection.SendRequestContentAsync(HttpRequestMessage request, HttpContentWriteStream stream, CancellationToken cancellationToken)
at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, CancellationToken cancellationToken)

Though it's not yet clear is the problem is in Ocelot.

@daoye
Copy link

daoye commented Jul 23, 2020

I have the same problem.

But, when I set the Ocelot and Upstream's "options.Limits.MaxRequestBodySize = null;"

It's fixed.

@Keerthikan
Copy link

Reroute configuration would be a better option, than enabling this application wide.

@ghost
Copy link

ghost commented Mar 30, 2022

@Keerthikan Can you guide how to do so with Reroute?

@maulik-modi
Copy link

#928 Chunked Encoding

@raman-m
Copy link
Member

raman-m commented Jan 20, 2024

Fixed by #1724 #1824

@ThreeMammals ThreeMammals locked and limited conversation to collaborators Jan 20, 2024
@raman-m raman-m converted this issue into discussion #1937 Jan 20, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants