[PR #15279] fix: return absolute path as the icon url if CONSOLE_API_URL is empty #28293

Closed
opened 2026-02-21 20:43:10 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/15279

State: closed
Merged: Yes


Summary

This is follow-up for #15241 by @crazywoola and @zhangxl01.

The PR #15241 solves the issue by Nginx, but I think the issue should be solved by the API side.

The issue is fundamentally caused by the API returning a relative path (without leading /) as the icon URL when the CONSOLE_API_URL is empty.

Image

If the specified URL does not start with /, the browser treats it as a relative path from the current URL. This causes 404 for all icons (See the screen shot below).

Simply ensuring that the API returns a path starting with / as the icon URL will resolve the issue, as the browser will interpret it as an absolute path from the root of the current domain.

Related #15189, #14668, #14835, #14570, #13982, #14835, #14578

Screenshots

Before After
Image Image

Checklist

Important

Please review the checklist below before submitting your pull request.

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods
**Original Pull Request:** https://github.com/langgenius/dify/pull/15279 **State:** closed **Merged:** Yes --- # Summary This is follow-up for #15241 by @crazywoola and @zhangxl01. - Reverts #15241 - Change API to solve the issue - Add test cases for `yarl.URL` The PR #15241 solves the issue by Nginx, but I think the issue should be solved by the API side. The issue is fundamentally caused by the API returning a relative path (without leading `/`) as the icon URL when the `CONSOLE_API_URL` is empty. ![Image](https://github.com/user-attachments/assets/3029278c-e6db-4e9d-a80c-0e8892ec38a8) If the specified URL does not start with `/`, the browser treats it as a relative path from the current URL. This causes 404 for all icons (See the screen shot below). Simply ensuring that the API returns a path starting with `/` as the icon URL will resolve the issue, as the browser will interpret it as an absolute path from the root of the current domain. Related #15189, #14668, #14835, #14570, #13982, #14835, #14578 # Screenshots | Before | After | |--------|-------| | ![Image](https://github.com/user-attachments/assets/fce381cf-0ddb-46c8-a101-2563baa7f2e2) | ![Image](https://github.com/user-attachments/assets/959c31a1-e026-4756-8d44-a56ed860dbaa) | # Checklist > [!IMPORTANT] > Please review the checklist below before submitting your pull request. - [ ] This change requires a documentation update, included: [Dify Document](https://github.com/langgenius/dify-docs) - [x] I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!) - [x] I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change. - [x] I've updated the documentation accordingly. - [ ] I ran `dev/reformat`(backend) and `cd web && npx lint-staged`(frontend) to appease the lint gods
yindo added the pull-request label 2026-02-21 20:43:10 -05:00
yindo closed this issue 2026-02-21 20:43:10 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#28293