Skip to content

Conversation

@krikera
Copy link
Contributor

@krikera krikera commented Jun 23, 2025

Fixes #21334

Problem

Using STORAGE_TYPE=local and FILES_URL=http://localhost no longer works in Docker environments. Plugin daemon cannot access files uploaded by users.

Solution

  • Added INTERNAL_FILES_URL config for Docker network communication
  • Plugin file access now uses internal Docker service URLs (e.g., http://api:5001)
  • User downloads continue using external URLs (e.g., http://localhost:5001)
  • Simple fallback: uses FILES_URL if INTERNAL_FILES_URL not set

Configuration

Add to Docker environment:

INTERNAL_FILES_URL=http://api:5001

Testing

  • ✅ Plugin file access works in Docker
  • ✅ User file downloads work from browser
  • ✅ Backward compatible with existing setups

- Add INTERNAL_FILES_URL config for Docker network communication
- Plugin file access now uses internal Docker service URLs
- User downloads continue using external FILES_URL
- Fixes plugin daemon file access in Docker environments
- Backward compatible with existing configurations
@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Jun 23, 2025
@crazywoola crazywoola requested a review from Yeuoly June 24, 2025 01:20
Yeuoly
Yeuoly previously requested changes Jun 24, 2025
Copy link
Contributor

@Yeuoly Yeuoly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess docker/*compose.yml need to be modified also.

- Add INTERNAL_FILES_URL to docker-compose.yaml environment variables
- Add configuration example and documentation to docker/.env.example
- Addresses reviewer feedback for Docker compose file updates
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Jun 24, 2025
@krikera krikera requested a review from Yeuoly June 24, 2025 08:04
crazywoola
crazywoola previously approved these changes Jul 11, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jul 11, 2025
@crazywoola crazywoola merged commit d5624ba into langgenius:main Jul 11, 2025
8 checks passed
yijiaquan pushed a commit to yijiaquan/dify that referenced this pull request Jul 14, 2025
@gk0916
Copy link

gk0916 commented Jul 31, 2025

Hello, I'm encountering an issue.
When set INTERNAL_FILES_URL=http://api:5001.
The URL of the output file of the tool node is prefixed with INTERNAL_FILES_URL. When the answer node references and outputs the file output by the tool node, the file URL displayed on the front end is also prefixed with INTERNAL_FILES_URL, which makes it impossible to preview and download the file on the front end.

The output of the answer node is as follows:
{
"answer": "1.wav",
"files": [
{
"dify_model_identity": "dify__file",
"id": null,
"tenant_id": "05f47de6-6d2a-4fb2-9c21-d57879a69f0a",
"type": "audio",
"transfer_method": "tool_file",
"remote_url": null,
"related_id": "c942b89f-5adb-4892-b685-da28ea9b3bc5",
"filename": "1.wav",
"extension": ".bin",
"mime_type": "audio/wav",
"size": 30064908,
"url": "http://api:5001/files/tools/c942b89f-5adb-4892-b685-da28ea9b3bc5.bin?timestamp=1753954013&nonce=a0b1a45fadfae82f95620094e0c9756d&sign=qYnbvkrgI_QA2o8fMRvIJ1JgJ9MUWW1RWC89MtlY0w8="
}
]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Using STORAGE_TYPE=local and settings FILES_URL=http://localhost no longer works locally (docker)

4 participants