[X] The issue exists on a clean installation of Fooocus
[X] The issue exists in the current version of Fooocus
[X] The issue has not been reported before recently
[ ] The issue has been reported before but has not been fixed yet
What happened?
Generated image URLs include a port number, causing them to fail when accessed behind a load balancer that exposes only ports 80 and 443. Removing the port number from the URL results in a 403 Forbidden error due to the requirement of a custom x-api-key header. Disabling the API key option allows image access without the port number.
Steps to reproduce the problem
Start the API using the following command:
python launch.py --listen 0.0.0.0 --port 8888 --base-url fooocusapi.your-url.com --apikey %fooocus-apikey% --debug-mode --nowebui
Generate an image using the API.
Attempt to access the generated image URL with the port number behind a load balancer (ports 80 and 443).
Remove the port number from the URL and attempt to access the image.
What should have happened?
Direct access to the generated image via URL without requiring a port number or custom header.
Remove the Port Number from Image URLs:
Ensure the FastAPI backend generates image URLs without including the port number, to maintain compatibility with load balancers exposing only ports 80 and 443.
Allow Image Retrieval without API Key:
Adjust the FastAPI configuration to allow public access to image retrieval endpoints without requiring the x-api-key header, while maintaining API key protection for all other operations.
I'd like the URL retrieval to work like it did originally by only requiring API keys for all other endpoints except the retrieval of images. This will keep the API operations secure while allowing easier access for users.
Checklist
What happened?
Generated image URLs include a port number, causing them to fail when accessed behind a load balancer that exposes only ports 80 and 443. Removing the port number from the URL results in a 403 Forbidden error due to the requirement of a custom x-api-key header. Disabling the API key option allows image access without the port number.
Steps to reproduce the problem
Start the API using the following command:
python launch.py --listen 0.0.0.0 --port 8888 --base-url fooocusapi.your-url.com --apikey %fooocus-apikey% --debug-mode --nowebui
Generate an image using the API.
Attempt to access the generated image URL with the port number behind a load balancer (ports 80 and 443).
Remove the port number from the URL and attempt to access the image.
What should have happened?
Direct access to the generated image via URL without requiring a port number or custom header.
What browsers do you use to access Fooocus?
Google Chrome, Microsoft Edge
Where are you running Fooocus?
Cloud (other)
What operating system are you using?
No response
Console logs
Additional information
What I'd like to see:
Remove the Port Number from Image URLs: Ensure the FastAPI backend generates image URLs without including the port number, to maintain compatibility with load balancers exposing only ports 80 and 443.
Allow Image Retrieval without API Key: Adjust the FastAPI configuration to allow public access to image retrieval endpoints without requiring the x-api-key header, while maintaining API key protection for all other operations.
I'd like the URL retrieval to work like it did originally by only requiring API keys for all other endpoints except the retrieval of images. This will keep the API operations secure while allowing easier access for users.