Upload progress bar significantly delayed when deployed behind Cloudflare #5413
Replies: 5 comments
-
|
ENG-6099 Upload progress bar significantly delayed when deployed behind Cloudflare |
Beta Was this translation helpful? Give feedback.
-
|
This is interesting we use cloudflare and have not experienced this - but maybe ours is set up differently Just to get some more context you are using cloudflare to serve your static files from reflex export and have a prod server with reflex running - is this server also behind cloudflare? |
Beta Was this translation helpful? Give feedback.
-
|
Thanks Alek, there's something certainly off with my setup then! The server is behind cloudflare. I have the app running on an EC2 instance (frontend @ port 3000, backend @ port 8000), and cloudflare points to the EC2 instance's public static IP. I don't know if the problem lies in cloudflare, or nginx or reflex itself :) I initially served my static files via reflex export, but the progress bar never showed up (not even after a delay). So I changed my setup to serve both front and backend live. These are my docker configs: Dockerfile (backend): web.Dockerfile (frontend): compose.yml nginx: |
Beta Was this translation helpful? Give feedback.
-
|
Any ideas? |
Beta Was this translation helpful? Give feedback.
-
|
Sorry don't have the bandwidth right now to help debug the infra set up. But in cloudflare logs you may be able to see if it's the culprit based on response time. I would tend to not think it's a framework related issue as we have production set ups where this hasn't been an issue. Also behind a CDN and load balancers Our hosting service handles all this but understand if you need to self host for some other reasons |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the bug
When deploying a Reflex app behind Cloudflare (with HTTPS enabled), the rx.upload(progress=True) component does not show the progress bar until the entire file upload is complete. The handle_upload() function on the backend is not triggered until the full body is received, which delays the start of the progress bar by 10–20 seconds for large files.
This behavior does not occur when the app is run locally (without a reverse proxy), where the progress bar appears immediately and tracks the upload in real time.
To Reproduce
Deploy a Reflex app using rx.upload(progress=True) behind NGINX and Cloudflare (proxy enabled).
Upload a large file (10MB+).
Observe the delayed appearance of the progress bar.
Check DevTools: the /_upload request shows Request Sent duration = 10–20s, with Waiting (TTFB) only starting after the file is fully uploaded.
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
https://github.com/user-attachments/assets/6a7c1b01-ac73-4ac3-9cf0-137a77ca9878
Specifics (please complete the following information):
Additional context
Add any other context about the problem here.
Beta Was this translation helpful? Give feedback.
All reactions