dotnet / dotnet/yarp

Reporting the original error code to the client even when the request is aborted

Open
#1,501 1 comment 3 reactions 0 assignees View on GitHub
Type: Bug
Dominant language
C#
Stars
9.6k
Forks
933
Avg merge
12d 18h
Merged PRs (30d)
2

Description

### Describe the bug

App coded to reject large POSTs with 400 BAD Request. (App also sends a FIN soon after).
Client using POSTMAN uploads a large file (larger than the value coded.)
There are two proxies chained here.

What is happening today:
• App returns error 400 almost immediately with a FIN
• Front Proxy is still reading payload from the client.
• Back Proxy turns around and sends TCP RESET to the Frontend.
• Front end on receiving the RESET sends back a 502 to the client.

Customer expectation:
The client receives the HTTP status returned by the APP

When using nginx instead for the second proxy, resets are delayed by ~30s so the response makes it through.

Current:
![image](https://user-images.githubusercontent.com/1821173/148441606-ff4a2f60-a03c-4389-a542-45b919f27971.png)

Desired:
![image](https://user-images.githubusercontent.com/1821173/148441640-65e21fae-c65d-4117-ae3a-847ee6fba007.png)

Note the default behavior will vary depending on if the 400 has a response body with it. That is more likely to cause the original response status to be flushed to the client before any upload errors are noticed. The scenario tested above did not include a response body.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.