This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
File upload & streamed response not working through NGINX #4600
Labels
You can continue the conversation there. Go to discussion →
First Check
Commit to Help
Example Code
Description
Streamed file requests, like the example above do not work when passing through nginx.
For some reason, whenever the above example is tried with the server before a NGINX proxy, with the proxy_pass directive, streamed requests do not get received by FastAPI.
eg.
Contacting the server with a file upload directly works:
$ curl -F 'file=@somefile.txt' http://directly_to_fastapi/uploadfile
but this does not:
$ curl -F 'file=@somefile.txt' http://through_nginx/api/uploadfile
Exiting with error:
I have searched far and wide for a solution to this, however it seems that no one has come up with any sane solution.
Furthermore, streamed requests also break when passing through NGINX, eg.
does not work with the same error returned, unless the FastAPI server is contacted directly (not through NGINX).
Operating System
Linux
Operating System Details
No response
FastAPI Version
0.74.0
Python Version
Python 3.10.1
Additional Context
I am running NGINX with the following Docker command line (for development):
My Docker version is:
And my full NGINX conf I am using to test this:
Logs from NGINX whenever request attempts to reach FastAPI server:
The text was updated successfully, but these errors were encountered: