-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
HTMX Form multipart fails to upload file in production - Empty request - Both [2.0.3] and [1.9.3] !! #3008
Comments
Hey, sounds weird, especially as you say it works fine locally, and as the
It sounds like a backend issue to me, as htmx has no reason to work differently between your 2 environments here. |
I reviewed tens of existing and past HTMX bug reports, added, removed various configs If a upload is lower than 5MB, it gets sent through.. If it's larger (say 20~50 mb) it fails. There is an empty request sent. On multiple browsers i had the same thing. I then set a timeout in HTMX with hx-request for 1000 seconds.. and HTMX eventually gave an error which cancelled the upload giving a server context error. ( HTMX error
Upon closer examination in the proxy config nothing seemed to time out, this lead me to investigate the backend and it does seem that there was a timeout setting somewhere. It was not clear to me if it was a readheader timeout or a simple read timeout so when I increased it to a certain point it seemed to work for certain uploads. It might be useful for HTMX to give an error if it can't upload, gets no response or gets a non 200 response especially when uploading. Because i'm thinking of the many cases when intermediary proxies CAN block. Luckily for me, caddy has sane defaults and no timeout exists and it was easier to debug. UPDATE: IT seems that even with updated timeouts, it still fails to upload and still sends the empty request so I still need to review this. |
When trying to upload a file via HTMX with multipart, it fails to do anything and just posts an empty request without any object/request information. (Empty request)
I've been trying to debug this and cannot seem to find any reason why HTMX fails to upload or send any object data for this particular field.
The file I'm trying to upload is between 40 and 60 MB.
On a local testing environment everything works flawlessly, same code/binary gets deployed to the webserver and then upload fails
Same issue occurs in both versions of HTMX "1.9.3" and upgraded to "2.0.3" seems to be the same thing.
I've been using firefox 115 and librewolf 131.
I should mention that I added hx-post and hx-encoding while debugging, previously, only the action field existed, and a hx-boost exists somewhere at top level.
I added the progress and on localhost it seems to function properly, on production it does something but then quickly jumps to full and a 400 HTTP error gets returned by the server.
Example code
The text was updated successfully, but these errors were encountered: