Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance CORS configuration with allowed domains from settings #564

Closed
wants to merge 3 commits into from

Conversation

medchedli
Copy link
Contributor

@medchedli medchedli commented Jan 13, 2025

Introduce a method to fetch allowed domains from settings and enhance CORS configuration by combining these domains with those specified in the environment.

Important considerations :

Issue 1 :

  • The current implementation fetches allowed domains from the settings service synchronously during the application bootstrap. While this works for initial loading, it doesn't inherently support real-time updates if the settings change after the server has started.
  • To achieve truly dynamic CORS configurations that reflect real-time changes in the settings, consider implementing a mechanism to update the allowed domains without restarting the server. This can be done using:
    • Event Emitters: Emit an event whenever the settings related to allowed_domains are updated, and update the CORS configuration accordingly.
    • Polling: Periodically fetch the latest settings and update the allowed domains.

Issue 2 :

  • Mixing configuration sources (settings service and .env) can lead to inconsistencies and make it harder to track where specific configurations originate.

Issue 3 :

  • Fetching allowed domains from the database can introduce latency, especially if the database is under heavy load.
  • Implement caching mechanisms to store allowed domains in memory, reducing the need for frequent database queries.

@medchedli medchedli assigned medchedli and abdou6666 and unassigned medchedli Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 [BUG] - CORS Configuration Ignores User-Defined Domains for the Web Chat Widget
3 participants