withoutbg-python icon indicating copy to clipboard operation
withoutbg-python copied to clipboard

Docker/Container Setup - Network Error for All Requests

Open danielhmetro opened this issue 1 year ago • 1 comments

Great project - read about this on XDA.

Followed these instructions but am having an issue getting this going on my Docker setup. It is running over my network, and I have it set to Port 8181 on the Host side.

What's Happening

Upon upload of a normal image, it is failing with "Network Error":

Image

Yet the logs server-side seem fine:

$ docker logs withoutbg
Loading Open Source models...
✓ Models loaded and ready for inference!
INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:80 (Press CTRL+C to quit)
INFO:     127.0.0.1:41134 - "GET /api/health HTTP/1.1" 200 OK
INFO:     10.x.x.x:52424 - "GET / HTTP/1.1" 200 OK
INFO:     10.x.x.x:52423 - "GET /assets/index-Bh652Ek0.css HTTP/1.1" 200 OK
INFO:     10.x.x.x:52424 - "GET /assets/index-BYgHMijO.js HTTP/1.1" 200 OK
INFO:     10.x.x.x:52424 - "GET /logo.png HTTP/1.1" 200 OK
INFO:     10.x.x.x:52424 - "GET /vite.svg HTTP/1.1" 200 OK
INFO:     127.0.0.1:42900 - "GET /api/health HTTP/1.1" 200 OK
INFO:     127.0.0.1:50022 - "GET /api/health HTTP/1.1" 200 OK
INFO:     127.0.0.1:34148 - "GET /api/health HTTP/1.1" 200 OK
INFO:     10.x.x.x:52459 - "POST /api/remove-background HTTP/1.1" 200 OK
INFO:     127.0.0.1:57668 - "GET /api/health HTTP/1.1" 200 OK
INFO:     127.0.0.1:46536 - "GET /api/health HTTP/1.1" 200 OK
INFO:     127.0.0.1:44394 - "GET /api/health HTTP/1.1" 200 OK

Visiting the URL as a GET request produces this error: Image

And corresponding 404 error on the server side: INFO: 10.x.x.x:52534 - "GET /api/remove-background HTTP/1.1" 404 Not Found

This also appears to be happening with the API Key version, which does deduct API calls from the online counter, yet still produces the Network Error message and no transparent photo.

Thank you in advance and let me know if I can provide any additional information.

danielhmetro avatar Dec 02 '25 03:12 danielhmetro

Thanks for reporting this issue!

The problem: The Content-Disposition header wasn't exposed in our CORS configuration, which prevented axios from properly handling blob responses when downloading the processed images.

The fix: I've updated the CORS middleware to expose the required header and changed the response disposition type. This is now released in the latest Docker image.

To get the fix:

docker pull withoutbg/withoutbg:latest

The network error should be resolved now. Please reopen the GitHub issue if it doesn't work!

kocabiyik avatar Dec 02 '25 22:12 kocabiyik