A problem with multimodal input of image URLs #6640

Closed
opened 2026-02-21 18:16:40 -05:00 by yindo · 5 comments
Owner

Originally created by @lichao4Java on GitHub (Nov 8, 2024).

Originally assigned to: @laipz8200 on GitHub.

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.11.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

URL such as:

https://xxx.amazonaws.com//upload_files/note/xxxxx/xxxxxpng?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20241108T160001Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3600&X-Amz-Credential=AKIA4MTWMGOVZZB6FYA3%2F20241108%2Fap-southeast-1%2Fs3%2Faws4_request&X-Amz-Signature=530bad9878793d65318d4eeea3bb001626b6668ed9d2e39e8518ff9b46d638de

image

open with chrome

image

✔️ Expected Behavior

Can input the valid signature URL photo normally

Actual Behavior

When I input a signed AWS S3 image URL, it cannot be uploaded properly. However, when I use a URL image from a public bucket, it can be uploaded normally.

What I confirm is that the signed URL is within its validity period and the photo can be downloaded using a browser or curl.

Originally created by @lichao4Java on GitHub (Nov 8, 2024). Originally assigned to: @laipz8200 on GitHub. ### Self Checks - [X] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [X] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [X] Please do not modify this template :) and fill in all the required fields. ### Dify version 0.11.0 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce URL such as: https://xxx.amazonaws.com//upload_files/note/xxxxx/xxxxxpng?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20241108T160001Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3600&X-Amz-Credential=AKIA4MTWMGOVZZB6FYA3%2F20241108%2Fap-southeast-1%2Fs3%2Faws4_request&X-Amz-Signature=530bad9878793d65318d4eeea3bb001626b6668ed9d2e39e8518ff9b46d638de ![image](https://github.com/user-attachments/assets/3faaf985-c985-4ed2-b2fb-634368cd8b4d) open with chrome ![image](https://github.com/user-attachments/assets/bd0e5e1a-1be4-495e-836d-63141a1e14c4) ### ✔️ Expected Behavior Can input the valid signature URL photo normally ### ❌ Actual Behavior When I input a signed AWS S3 image URL, it cannot be uploaded properly. However, when I use a URL image from a public bucket, it can be uploaded normally. What I confirm is that the signed URL is within its validity period and the photo can be downloaded using a browser or curl.
yindo added the 🐞 bug label 2026-02-21 18:16:40 -05:00
yindo closed this issue 2026-02-21 18:16:40 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Nov 8, 2024):

A similar issue has been discussed in the Dify repository, where a signed AWS S3 image URL cannot be uploaded properly in the multimodal input, while a URL image from a public bucket can be uploaded normally. This issue might be related to how the ssrf_proxy handles the signed URL. The ssrf_proxy first attempts a HEAD request, and if it fails, it falls back to a GET request. The problem could arise if the signed URL requires specific headers or query parameters that are not correctly handled during the HEAD request. Additionally, if HEAD requests are not permitted by the signed URL, this could cause the initial request to fail [1].

To resolve this, ensure that the signed URL is used exactly as provided, without modifications, and that all necessary headers and query parameters are included. If HEAD requests are not supported, consider adjusting the logic to directly use a GET request instead.

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Nov 8, 2024): <!-- Answer --> A similar issue has been discussed in the Dify repository, where a signed AWS S3 image URL cannot be uploaded properly in the multimodal input, while a URL image from a public bucket can be uploaded normally. This issue might be related to how the `ssrf_proxy` handles the signed URL. The `ssrf_proxy` first attempts a `HEAD` request, and if it fails, it falls back to a `GET` request. The problem could arise if the signed URL requires specific headers or query parameters that are not correctly handled during the `HEAD` request. Additionally, if `HEAD` requests are not permitted by the signed URL, this could cause the initial request to fail <sup>[[1]](https://github.com/langgenius/dify/blob/main/api/controllers/web/remote_files.py)</sup>. To resolve this, ensure that the signed URL is used exactly as provided, without modifications, and that all necessary headers and query parameters are included. If `HEAD` requests are not supported, consider adjusting the logic to directly use a `GET` request instead. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@lichao4Java commented on GitHub (Nov 8, 2024):

the AWS S3 image URL can be open with Chrome or Can Download with curl .

@lichao4Java commented on GitHub (Nov 8, 2024): the AWS S3 image URL can be open with Chrome or Can Download with curl .
Author
Owner

@lichao4Java commented on GitHub (Nov 8, 2024):

the input signed URL use SDK with aws-java-sdk-s3, such as:

 GeneratePresignedUrlRequest generatePresignedUrlRequest =
                new GeneratePresignedUrlRequest(privateFileBucket, fileKey)
                        .withMethod(HttpMethod.GET)
                        .withExpiration(expiration);

URL url = amazonS3.generatePresignedUrl(generatePresignedUrlRequest);
return url.toString();
@lichao4Java commented on GitHub (Nov 8, 2024): the input signed URL use SDK with aws-java-sdk-s3, such as: ``` GeneratePresignedUrlRequest generatePresignedUrlRequest = new GeneratePresignedUrlRequest(privateFileBucket, fileKey) .withMethod(HttpMethod.GET) .withExpiration(expiration); URL url = amazonS3.generatePresignedUrl(generatePresignedUrlRequest); return url.toString(); ```
Author
Owner

@laipz8200 commented on GitHub (Nov 11, 2024):

It's because S3 doesn't support HEAD requests, which was fixed in #10370

@laipz8200 commented on GitHub (Nov 11, 2024): It's because S3 doesn't support HEAD requests, which was fixed in #10370
Author
Owner

@lichao4Java commented on GitHub (Nov 11, 2024):

It's because S3 doesn't support HEAD requests, which was fixed in #10370

but s3 public bucket url is working。。

@lichao4Java commented on GitHub (Nov 11, 2024): > It's because S3 doesn't support HEAD requests, which was fixed in #10370 but s3 public bucket url is working。。
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#6640