EventSource URL is? #5604

Closed
opened 2026-02-21 18:11:50 -05:00 by yindo · 1 comment
Owner

Originally created by @wangjienihao on GitHub (Sep 13, 2024).

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

v1

Cloud or Self Hosted

Cloud

Steps to reproduce

Why does using Dify's v1/chat-messages API to connect with EventSource for receiving messages cause CORS (Cross-Origin Resource Sharing) issues?
Is the correct URL for EventSource when using this API: https://api.dify.ai/v1/chat-messages?

image

✔️ Expected Behavior

Certainly! Here is the translation of your content into English:

"I would like to use https://api.dify.ai/v1/chat-messages to listen to streaming messages, so is the EventSource address: https://api.dify.ai/v1/chat-messages? Because when I investigated this way, I encountered a cross-origin issue.

I want to obtain the EventSource address."

Actual Behavior

"EventSource cannot listen to streaming-type messages."

Originally created by @wangjienihao on GitHub (Sep 13, 2024). ### 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 v1 ### Cloud or Self Hosted Cloud ### Steps to reproduce Why does using Dify's v1/chat-messages API to connect with EventSource for receiving messages cause CORS (Cross-Origin Resource Sharing) issues? Is the correct URL for EventSource when using this API: https://api.dify.ai/v1/chat-messages? <img width="1674" alt="image" src="https://github.com/user-attachments/assets/c06bb9ea-9f18-4dae-8a8e-bbd714635883"> ### ✔️ Expected Behavior Certainly! Here is the translation of your content into English: "I would like to use https://api.dify.ai/v1/chat-messages to listen to streaming messages, so is the EventSource address: https://api.dify.ai/v1/chat-messages? Because when I investigated this way, I encountered a cross-origin issue. I want to obtain the EventSource address." ### ❌ Actual Behavior "EventSource cannot listen to streaming-type messages."
yindo added the 🙋‍♂️ question label 2026-02-21 18:11:50 -05:00
yindo closed this issue 2026-02-21 18:11:50 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Sep 13, 2024):

@wangjienihao Hello there! I'm Dosu, a bot here to help you with bug reports, questions, and becoming a contributor while you wait for a human maintainer.

The correct EventSource URL for using Dify's v1/chat-messages API to receive streaming messages without encountering CORS issues is:

https://api.dify.ai/v1/chat-messages

Make sure that the server-side CORS settings are configured to allow the client-side domain from which the EventSource requests are made [1].

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Sep 13, 2024): <!-- Greeting --> @wangjienihao Hello there! I'm Dosu, a bot here to help you with bug reports, questions, and becoming a contributor while you wait for a human maintainer. <!-- Answer --> The correct EventSource URL for using Dify's `v1/chat-messages` API to receive streaming messages without encountering CORS issues is: ``` https://api.dify.ai/v1/chat-messages ``` Make sure that the server-side CORS settings are configured to allow the client-side domain from which the EventSource requests are made <sup>[[1]](https://github.com/langgenius/dify-docs/blob/main/zh_CN/guides/application-publishing/developing-with-apis.md)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#5604