-
Notifications
You must be signed in to change notification settings - Fork 3
Description
When using FileUploaderRegular in a Docker development environment, the OPTIONS preflight request to Uploadcare's API hangs indefinitely, causing file uploads to fail with a 405 error.
The core issue: The React uploader's OPTIONS preflight request is missing critical browser headers compared to the working jQuery widget, causing the request to hang.
Comparison of OPTIONS Requests:
✅ Working (jQuery widget) - includes these headers:
Accept-Language: en-US,en;q=0.9
Cache-Control: no-cache
Connection: keep-alive
Pragma: no-cache
Referer: http://127.0.0.1:8000/
Sec-Fetch-Dest: empty
Sec-Fetch-Site: cross-site
❌ Failing (React uploader) - missing all of the above headers
The incomplete OPTIONS request causes the preflight to hang indefinitely (stays in "pending" state in Network tab), and the subsequent POST request fails.
Steps to reproduce:
- Set up a React app in Docker, accessed via
http://localhost:8000orhttp://127.0.0.1:8000 - Import and use
FileUploaderRegularcomponent - Drop or select an image file
- Open browser DevTools → Network tab
- Observe: OPTIONS request to
https://upload.uploadcare.com/base/?jsonerrors=1stays in "pending" - Eventually get error:
{"error": {"status_code": 405, "content": "HTTP method GET is not allowed for /base/", "error_code": "MethodNotAllowedError"}}
Note: The old jQuery Uploadcare widget works perfectly in the same environment with identical setup.
Expected behavior
The OPTIONS preflight request should complete successfully with status 200 (like the jQuery widget does), followed by a successful POST request uploading the file.
Code / screenshots
import { FileUploaderRegular } from '@uploadcare/react-uploader';
import '@uploadcare/react-uploader/core.css';
function App() {
return (
<FileUploaderRegular
pubkey="demopublickey"
onChange={(e) => console.log('File uploaded:', e.detail)}
/>
);
}Network tab showing hanging OPTIONS request:
- OPTIONS request: Status "pending" (never completes)
- POST request: Status 405 "Method Not Allowed"
Working jQuery widget OPTIONS request completes in ~20ms with status 200
Environment
- Library version:
@uploadcare/react-uploader@1.10.2(also tested with1.8.1, same issue) - Language/framework version: React 18, TypeScript 5
- OS version: WSL, running in Docker container, accessed via Chrome 141.0.0.0