How can I make the CORS works? #10923
Replies: 3 comments
-
It seems like you're experiencing an issue where your CORS settings are not being enforced as expected. Here are a few things to consider:
By reviewing these aspects, you should be able to identify why the CORS settings are not being enforced as you intended. If the issue persists, consider checking the Dify documentation or any related discussions for additional insights. |
Beta Was this translation helpful? Give feedback.
-
@dosu I’m using |
Beta Was this translation helpful? Give feedback.
-
For questions, please use discussion instead. |
Beta Was this translation helpful? Give feedback.
-
Self Checks
Dify version
0.11.0
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
Does anyone know how CORS works? I expected this setting to block other domains from embedding my web app, but when I embed the Dify web app in my local Vue 3 project (
localhost:1002
), it works without any errors. Can someone help me understand why?My Setup and Scenarios:
Docker Compose Setup:
I configured Dify with
EXPOSE_NGINX_PORT=8001
, allowing access viahttp://localhost:8001/apps
.Relevant environment variables:
Vue 3 Project:
I built a basic Vue 3 project running on
http://localhost:1002
and embedded the Dify app into it.Embed Workflow:
I created a workflow in Dify, published it, and used the following embed code in the Vue 3 project:
Testing:
After copying the embed code to my Vue 3 project, I was able to interact with the workflow seamlessly.
The Issue:
I expected this setup to trigger a CORS error since I limited
WEB_API_CORS_ALLOW_ORIGINS
andCONSOLE_CORS_ALLOW_ORIGINS
tohttps://dify.app
. However, everything works fine without any errors.Question:
How can I configure CORS properly to prevent other domains from embedding my chatbot? What am I missing in my setup?
✔️ Expected Behavior
I expected this setup to trigger a CORS error since I limited
WEB_API_CORS_ALLOW_ORIGINS
andCONSOLE_CORS_ALLOW_ORIGINS
tohttps://dify.app
.❌ Actual Behavior
However, everything works fine without any errors.
Beta Was this translation helpful? Give feedback.
All reactions